Detect if host is running GNOME-based or other-based DE

Hi!
I am writing a contribution for a gtk application that lets you merge the Menu into a GtkHeaderBar. I want to enable this setting by default to the most quantity of users without hurting users from non-GNOME DEs, who prefer to use their DE’s windows decorations.
Is there a way to detect if the user is running a GNOME-based DE vs KDE or XFCE?

In theory, you could use the contents of the XDG_CURRENT_DESKTOP environment variable; it’s a colon-separated list of environments, so you’ll have to split it into a vector of strings, and then see if it contains “GNOME”.

Fixed by using DESKTOP_SESSION. Note that DESKTOP_SESSION differentiates e.g. gnome from ubuntu-destkop or pantheon.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.