xsession: use systemd graphical targets

The systemd targets don't allow direct startup so we create our own
target for graphical sessions managed by Home Environment.
This commit is contained in:
Robert Helgesson 2017-06-26 18:26:54 +02:00
parent a9343d8194
commit acf8d4e985
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86

View file

@ -60,19 +60,12 @@ in
}; };
}; };
# For stuff that needs to start just before a graphical session # A basic graphical session target for Home Manager.
# starts. systemd.user.targets.he-graphical-session = {
systemd.user.targets.graphical-session-pre = {
Unit = { Unit = {
Description = "Pre-graphical session"; Description = "Home Manager X session";
}; Requires = [ "graphical-session-pre.target" ];
}; BindsTo = [ "graphical-session.target" ];
# A basic graphical session target. Apparently this will come
# standard in future Systemd versions.
systemd.user.targets.graphical-session = {
Unit = {
Description = "Graphical session";
}; };
}; };
@ -83,6 +76,9 @@ in
. "$HOME/.profile" . "$HOME/.profile"
fi fi
# If there are any running services from a previous session.
systemctl --user stop graphical-session.target graphical-session-pre.target
systemctl --user import-environment DBUS_SESSION_BUS_ADDRESS systemctl --user import-environment DBUS_SESSION_BUS_ADDRESS
systemctl --user import-environment DISPLAY systemctl --user import-environment DISPLAY
systemctl --user import-environment SSH_AUTH_SOCK systemctl --user import-environment SSH_AUTH_SOCK
@ -90,8 +86,7 @@ in
systemctl --user import-environment XDG_DATA_DIRS systemctl --user import-environment XDG_DATA_DIRS
systemctl --user import-environment XDG_RUNTIME_DIR systemctl --user import-environment XDG_RUNTIME_DIR
systemctl --user restart graphical-session-pre.target systemctl --user start he-graphical-session.target
systemctl --user restart graphical-session.target
${cfg.initExtra} ${cfg.initExtra}