On Wed, May 11, 2016 at 7:13 PM, Martin Pitt <martin.p...@ubuntu.com> wrote:

> Hello all,
>
> I've been experimenting with systemd --user as a possible replacement
> for bringing up graphical user sessions. We currently bring up most of
> that using upstart jobs (simple auto-restart on crashes, rate
> limiting, per-job logging, fine-grained startup condition control).
> There is one upstart process per session, so this is reasonably
> straightforward.
>
> But I still can't wrap my head around the mental model of how this is
> supposed to work with the user D-Bus and systemd instance. This works
> fine for some services which are not specific to a session, such as
> gvfs or pulseaudio, but it's not at all appropriate for user-facing
> applications or desktop components, such as gnome-terminal[1],
> gnome-session, the window manager, indicators, etc. They are
> necessarily per-session, and sometimes even need to be keyed off the
>

AFAIK, the general idea of --user is that there's at most one graphical
session (per user) at a time, so things like $DISPLAY naturally become per
user.

(It's not actually that bad, if you think how many people have been
hardcoding :0 or grepping `ps -ef` to map an UID to display/xauthority/bus
until now...)

I can start this with "systemctl --user start xeyes@${XDG_SESSION_ID}",
> but this will hang off user@1000.service instead of session-*.scope
> and thus it will not be stopped once the X session gets logged out.
>

Most X11 clients will exit as soon as the X server goes away, no?


> Is this all in vain, and we need to make the *entire* world of free
> software shift over to the new model of "user-wide services" before we
> can use systemd --user for graphical stuff? (Colin's patch list is
> already impressively long and it is by far not complete)
>

I think most programs will work as is just fine, as long as $DISPLAY is
passed to the --user instance and the dbus-daemon.


> Or is someone actually using systemd --user for graphical sessions
> already and found a trick that I missed?
>

`systemctl --user import-environment DISPLAY` seems to work well enough.
(There's also `dbus-update-activation-environment` which can push
environment into both dbus-daemon and systemd at once.)

In stock GNOME, I already have a bunch of bus-activated apps running off
the user bus (dbus.service), such as gedit, nautilus, or gnome-terminal;
the latter finally got its own gnome-terminal.service in 3.20.2.

(I don't include XAUTHORITY in the above example because Xorg has long
supported UID-based access control via `xhost +si:localuser:XXX`, e.g. gdm
sets that up by default.)

-- 
Mantas Mikulėnas <graw...@gmail.com>
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to