Replace GNOME_SHELL_SESSION_MODE with a read on XDG_CURRENT_DESKTOP
By renaming the mode configurations, we could base it of XDG_CURRENT_DESKTOP
rather than a custom variable. This is set by the session definition or GDM. It seems like it could be saner than a custom environment variable.
We have two use cases:
- Put GNOME shell into GDM/initial-setup mode
- Change the behaviour of specific sessions (GNOME Classic mode, which is e.g. also used by Remmina)
XDG_CURRENT_DESKTOP
is currently set to:
- GDM/initial-setup:
GNOME-Greeter:GNOME
(set by GDM directly) - gnome-classic:
GNOME-Classic:GNOME
- remmina:
GNOME
(third party which exportsGNOME_SHELL_SESSION_MODE=classic
)
If we changed
- initial-setup to e.g.
GNOME-initial-setup:GNOME
(by patching GDM) - remmina to also use
GNOME-Classic:GNOME
(or something custom)
then we could derive the session mode name directly from XDG_CURRENT_DESKTOP
. i.e. just try the entries in-order and pick the first matching mode (or fall back to user
).
Does that seem reasonable?