i3/i3

i3 session does not activate systemd graphical-session.target

開放

#5,186 建立於 2022年10月2日

 (19 則留言) (6 個反應) (0 位負責人)C (752 個分叉)batch import
acceptedenhancementhelp wanted

倉庫指標

星標
 (8,813 顆星)
PR 合併指標
 (平均合併 2天 21小時) (30 天內合併 1 個 PR)

描述

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.

貢獻者指南