i3/i3

i3 session does not activate systemd graphical-session.target

Ouverte

#5 186 ouverte le 2 oct. 2022

 (19 commentaires) (6 réactions) (0 personne assignée)C (752 forks)batch import
acceptedenhancementhelp wanted

Métriques du dépôt

Stars
 (8 813 étoiles)
Métriques de merge PR
 (Merge moyen 2j 21h) (1 PR mergée en 30 j)

Description

I'm submitting a…

Note: The report is targeting Debian but applies to i3 in general.

Forwarded from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1003816.

systemd defines a special (user) target called graphical-session.target which should be active when the user is logged into a graphical session. Currently, when I'm logged into a default i3 session (entered via GDM), this target is inactive:

  $ systemctl --user status graphical-session.target
  ● graphical-session.target - Current graphical user session
       Loaded: loaded (/usr/lib/systemd/user/graphical-session.target; static)
       Active: inactive (dead)
         Docs: man:systemd.special(7)

If I understood the clarifications in a thread on systemd's mailing list and the linked slides correctly, this target should be activated by specifying the session in question as a systemd service with BindsTo=graphical-session.target and launching this service from the relevant /usr/share/xsessions/*.desktop instead of launching the session directly.

In i3's case, the /usr/share/xsessions/i3.desktop session definition is provided by the i3-wm package and just launches i3 directly. This makes perfect sense, as systemd isn't mandatory on Debian and the aforementioned session-as-service mechanism wouldn't work at all for people using SysVinit. But perhaps there could be two session definitions, one with and one without an associated systemd service?

An objection I expect is that users should just write their own session files if they need this "feature", but the same would apply to the default /usr/share/xsessions/i3.desktop file, which is only included for compatibility with common display/login managers. Ditto for the argument that this is out of scope for a window manager and gets into desktop environment territory. Besides, it's not merely a missing feature but a bug (not necessarily in the i3 package but somewhere in the Debian distribution): Promises that are made in systemd's documentation are not kept when using distribution-provided graphical session definitions.

Unfortunately, the only precedent for this type of session file in other window manager or desktop environment packages I could find is in the gnome-session- common package (apt-file search session.target), so perhaps it would in fact be better to provide this via a separate package? There are a bunch of packages for the Openbox window manager that do nothing but provide sessions for running it along with the non-WM processes of common desktop environments (openbox- gnome-session, openbox-lxde-session, openbox-kde-session, ...), so a package providing only a session file for running i3 in a systemd-compatible manner doesn't sound totally unreasonable to me. This could then be suggested by the i3 package.

Guide contributeur