Unfortunately, there seems to be some confusion as to which session processes belong to when they are started through systemd. This currently means for example that we cannot VT switch if we start gnome-shell using systemd, as the DBus call fails with:
Caller does not belong to any known session
As sd_pid_get_session cannot work in this case, GNOME is adding code in various places to instead use sd_uid_get_display with a fallback to iterating the session and also including ones of type greeter(in mutter) or iterating users sessions to find the oldest graphical one (e.g. in gnome-session).
It seems like logind itself needs the same kind of heuristics to allow gnome-shell/mutter to do VT switching when it is being launched through systemd. sd_uid_get_display cannot currently be used for this because greeter type session are excluded.
I imagine that this heuristic could be public API.
CC: @smvc, @ iainlane
Unfortunately, there seems to be some confusion as to which session processes belong to when they are started through systemd. This currently means for example that we cannot VT switch if we start
gnome-shellusing systemd, as the DBus call fails with:As
sd_pid_get_sessioncannot work in this case, GNOME is adding code in various places to instead usesd_uid_get_displaywith a fallback to iterating the session and also including ones of typegreeter(in mutter) or iterating users sessions to find the oldest graphical one (e.g. in gnome-session).It seems like logind itself needs the same kind of heuristics to allow gnome-shell/mutter to do VT switching when it is being launched through systemd.
sd_uid_get_displaycannot currently be used for this becausegreetertype session are excluded.I imagine that this heuristic could be public API.
CC: @smvc, @ iainlane