slgobinath / SafeEyes

Protect your eyes from eye strain using this simple and beautiful, yet extensible break reminder
http://slgobinath.github.io/SafeEyes/
GNU General Public License v3.0
1.45k stars 163 forks source link

Use standardized environment variable for desktop detection #588

Open deltragon opened 3 months ago

deltragon commented 3 months ago

Currently, we (mostly) use DESKTOP_SESSION - however, that seems to be something that only happened to be supported, but never actually standardized. (Eg. sway already doesn't support it, for it we already use XDG_CURRENT_DESKTOP.) Additionally, this non-standardization leads to issues like https://github.com/slgobinath/SafeEyes/pull/546 - where distros just change DESKTOP_SESSION as they see fit.

There are two options here:

It seems slightly preferable to use XDG_CURRENT_DESKTOP, as it is more standard. However, then we need to handle the multi-value case (probably best to just use the first value we recognize).

archisman-panigrahi commented 3 months ago

I am running Kubuntu 24.04 (Plasma 5.27 with Wayland), and echo $XDG_CURRENT_SESSION generates an empty output

archisman-panigrahi commented 3 months ago

XDG_CURRENT_DESKTOP is KDE, but XDG_DESKTOP_SESSION is blank.

$ echo $XDG_CURRENT_DESKTOP
KDE
$ echo $XDG_DESKTOP_SESSION
deltragon commented 3 months ago

I typoed it - it's supposed to be XDG_SESSION_DESKTOP

deltragon commented 3 months ago

FTR, on Fedora 41/Plasma 6 Wayland I get:

DESKTOP_SESSION=plasma
XDG_SESSION_DESKTOP=KDE
XDG_CURRENT_DESKTOP=KDE