[systemd-devel] Per session systemd?
Lennart Poettering
lennart at poettering.net
Mon Mar 3 07:05:57 PST 2014
On Mon, 03.03.14 19:16, Yuxuan Shui (yshuiv7 at gmail.com) wrote:
> Hi,
>
> After reading some more mails and thinking about it a bit more, I seems to
> have a better understanding.
>
> I know that a per-user systemd is used to start service which should only
> be started once for every user. But I also want systemd to be able to start
> applications for every session (e.g. window manager), which is hard to do
> with the currect systemd --user implementation.
>
> I think there're two solutions here.
>
> 1) A per-session systemd instance. That's possibly the most simple
> solution. The changes needed is adding a 'User=' property to session unit,
> and give the change the ownership of the session cgroup to the given user.
> Then the user could start systemd after he start X (e.g. put systemd into
> .xinitrc). Also systemd probably have to read configuration files from a
> different position as the systemd --user (e.g.
> $XDG_CONFIG_HOME/systemd/session).
We want to move from a per-session to a per-user scheme to simplify
things, not making it moer complicated...
> One advantage of this solutions is that systemd will automatically have all
> the environment variables set up during the X startup sequence.
>
> 2) Let the per-user systemd start service in session. I think this is what
> David meant. I don't know what changes are needed in systemd to do this.
> Since the session cgroup is owned by root, maybe the ownership should be
> changed to the user? Or a new systemd API to start service in a given
> session?
In the long run the idea is that a desktop compositor/WM will be a
singleton that manages the devices of all local sessions you might have
created, and merges them into a single virtual huge workplace. If you
log into two seats they will thus magically merge into one big
workplace. Each time you log into a seat you can more real estate added
to your existing compositor.
In the short term the compositors can't do this just yet, so the idea is
that the first time you login we start the compositor/WM on that
screen. And if you login a second time on another seat you will get a
simply dialog that gives you two options: "Disconnect other session"
and "Disconnect this session".
And a third option is to just work-around our ideas by making your WM a
templated service:
my-wm at .service:
[Service]
Environment=DISPLAY=%I
ExecStart=/usr/bin/my-wm
And then when you log in run "systemctl start my-wm@$DISPLAY.service"
and you get it loaded.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list