On Wed, 11 May 2016 12:13:45 -0400, Martin Pitt wrote: > Or is someone actually using systemd --user for graphical sessions > already and found a trick that I missed?
I am! For several months now (and before that, I was still using systemd --user for graphical stuff, but not consistently/coherently). My configuration: https://lukeshu.com/git/dotfiles/tree/.config Crappy write-up: https://lukeshu.com/blog/x11-systemd.html One thing to note is that I don't use a DE, and have minimal bus-activated services. The big difference between what I do and what you wrote is that I don't tie the DISPLAY name to the XDG_SESSION_ID (actually, the session ID isn't even set in the graphical session). The short version of how I have it work: My ~/.xinitrc (AKA: script that starts the initial X11 clients) contains: _DISPLAY="$(systemd-escape -- "$DISPLAY")" mkfifo "${XDG_RUNTIME_DIR}/x11-wm@${_DISPLAY}" cat < "${XDG_RUNTIME_DIR}/x11-wm@${_DISPLAY}" & systemctl --user start "X11@${_DISPLAY}.target" & wait systemctl --user stop "X11@${_DISPLAY}.target" Which basically says: start X11@:0.target, wait for something to open "${XDG_RUNTIME_DIR}/x11-wm@${_DISPLAY}" for writing and then close it, then stop X11@:0.target. Then I have my window manager configured to open/close the file when I want to quit X11/log out (really, I have it open at start, then just exit on quit; implicitly closing it). Then, each of the whatever@${DISPLAY}.service files contains: [Unit] After=X11@%i.target Requisite=X11@%i.target [Service] Environment=DISPLAY=%I Now, when I launch a program from the window manager, I have it launch with `systemd-run --user --scope -- sh -c "COMMAND HERE"`, so that systemd can tell the difference between it and the window manager. I imagine that this would be problematic with less configurable window managers. As I type this, I have two graphical logins to the same user. One on a real screen, and the other with a fake screen via `vncserver` (of course, managed as a systemd user unit :-) ). The only problem I have with this setup is that dunst (my desktop notification daemon) isn't happy running multiple instances on different displays. I think it's because it isn't happy sharing the dbus, but I haven't spent even 1 minute debugging it yet. -- Happy hacking, ~ Luke Shumaker _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel