1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

xsession: improve initialization script

This adds a `graphical-session-pre` target for things that need to run
just before the main session starts. Also adds a loop during shutdown
that waits until all deactivating units are gone. Inspired by
<https://youtu.be/hq18daxTkLA>.
This commit is contained in:
Robert Helgesson 2017-01-15 10:46:20 +01:00
parent 75bb0c8efb
commit 6ec3026e51
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86

View file

@ -53,6 +53,14 @@ in
};
};
# For stuff that needs to start just before a graphical session
# starts.
systemd.user.targets.graphical-session-pre = {
Unit = {
Description = "Pre-graphical session";
};
};
# A basic graphical session target. Apparently this will come
# standard in future Systemd versions.
systemd.user.targets.graphical-session = {
@ -73,13 +81,21 @@ in
systemctl --user import-environment XAUTHORITY
systemctl --user import-environment XDG_DATA_DIRS
systemctl --user import-environment XDG_RUNTIME_DIR
systemctl --user start graphical-session.target
systemctl --user restart graphical-session-pre.target
systemctl --user restart graphical-session.target
${cfg.initExtra}
${cfg.windowManager}
systemctl --user stop graphical-session.target
systemctl --user stop graphical-session-pre.target
# Wait until the units actually stop.
while [[ -n "$(systemctl --user --no-legend --state=deactivating list-units)" ]]; do
sleep 0.5
done
'';
};
};