Re: How to detect a gtk desktop programmatically



Here's a Gnome-project commit making similar assumptions:
https://gitlab.gnome.org/GNOME/glib-networking/commit/89c45b82b85daef0f1e679dbd15a9c7c893deb17#d53b9ec213c7c4dd230c7ad15ccf62b542a79279_316_316

As indicated in previous emails, XDG_CURRENT_DESKTOP is less reliable as it relies on string comparison which will ultimately ignore desktops which override this value.  The Gnome commit seems to be in agreement of this, so I feel a better technique is warranted.  I'm happy to hear arguments to the contrary.



On Wed, Apr 29, 2020 at 3:32 PM Tres Finocchiaro <tres finocchiaro gmail com> wrote:
It appears a lot of Debian code still relies on this missing value.

Some have switched to this technique:

os.getenv("XDG_CURRENT_DESKTOP", "").endswith("GNOME") 

... however for reasons mentioned earlier, this will fail on XFCE, Pantheon and many others as they set this value, so the C-code which sets it in Gnome3 kindly leaves it alone.

Ubuntu it kind enough to append "ubuntu:GNOME", so the above line works, but this doesn't seem to be a universally adopted standard.

It seems it would be of great service to expose something.  I'm not sure I agree that an environment variable is a bad way to do this, it's a variable which describes the environment.  It seems just about perfect. ;)


On Wed, Apr 29, 2020 at 3:27 PM Tres Finocchiaro <tres finocchiaro gmail com> wrote:
For reference, the commit which introduced this change:
https://gitlab.gnome.org/GNOME/gnome-session/commit/00e0e6226371d53f651cc881e74c0543192c94a8#5b3005b925ed5c2612a9604ad3c756b1f9472165

Note, at the time of committing that, Debian still had 225 instances of the OS relying on this for detection of a Gtk-desktop (such as the mail launcher to prefer Evolution to KMail, etc).

I'll browse the Debian code to see how they've worked around this issue since.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]