From 2e9fa46f2f6e77a7977e625ad37c3b0c203b1d16 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 19 Jan 2020 20:28:04 +0100 Subject: [PATCH] systemd: create our own graphical-session@.target graphical-session.target is an existing target for the system. While I don't use several X sessions, I prefer to have each service bound to the right display and therefore, I create my own graphical-session@.target for this purpose. Also, I don't like having to use `systemctl --user enable`, so I enable everything directly in graphical-session@.target. Other dependencies are ordered from awesome@.service. This seems good enough. --- systemd/autorandr@.service | 2 +- systemd/awesome@.service | 9 +++++---- systemd/compton@.service | 2 +- systemd/graphical-session@.target | 14 ++++++++++++++ systemd/inputplug@.service | 2 +- systemd/misc-x@.service | 2 +- systemd/nm-applet@.service | 2 +- systemd/policykit-agent@.service | 2 +- systemd/redshift@.service | 2 +- systemd/xiccd@.service | 2 +- systemd/xsession@.target | 2 +- systemd/xsettingsd@.service | 2 +- systemd/xss-lock@.service | 2 +- 13 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 systemd/graphical-session@.target diff --git a/systemd/autorandr@.service b/systemd/autorandr@.service index 72cbfd6..9a1faef 100644 --- a/systemd/autorandr@.service +++ b/systemd/autorandr@.service @@ -1,5 +1,5 @@ [Unit] -Description=Configure displays +Description=Configure monitors on %I PartOf=graphical-session@%i.target [Service] diff --git a/systemd/awesome@.service b/systemd/awesome@.service index 6f6183d..c43de3d 100644 --- a/systemd/awesome@.service +++ b/systemd/awesome@.service @@ -1,12 +1,13 @@ [Unit] -Description=Awesome window manager +Description=Awesome window manager for %I PartOf=graphical-session@%i.target +After=autorandr@%i.service +After=compton@%i.service +After=xsettingsd@%i.service +Before=nm-applet@%i.service [Service] Environment=DISPLAY=%I ExecStart=/usr/bin/awesome ExecStopPost=/bin/systemctl --user stop graphical-session@%i.target Restart=on-failure - -[Install] -RequiredBy=xsession@%i.target diff --git a/systemd/compton@.service b/systemd/compton@.service index bbcb6c4..c904929 100644 --- a/systemd/compton@.service +++ b/systemd/compton@.service @@ -1,5 +1,5 @@ [Unit] -Description=Compositor for X11 +Description=Compositor for X11 on %I PartOf=graphical-session@%i.target [Service] diff --git a/systemd/graphical-session@.target b/systemd/graphical-session@.target new file mode 100644 index 0000000..8ed19a6 --- /dev/null +++ b/systemd/graphical-session@.target @@ -0,0 +1,14 @@ +[Unit] +Description=Graphical user session for %I +StopWhenUnneeded=yes +Wants=awesome@%i.service +Wants=autorandr@%i.service +Wants=compton@%i.service +Wants=inputplug@%i.service +Wants=misc-x@%i.service +Wants=nm-applet@%i.service +Wants=policykit-agent@%i.service +Wants=redshift@%i.service +Wants=xiccd@%i.service +Wants=xsettingsd@%i.service +Wants=xss-lock@%i.service diff --git a/systemd/inputplug@.service b/systemd/inputplug@.service index bd9e0fb..1089f9c 100644 --- a/systemd/inputplug@.service +++ b/systemd/inputplug@.service @@ -1,5 +1,5 @@ [Unit] -Description=XInput event monitor +Description=XInput event monitor for %I PartOf=graphical-session@%i.target [Service] diff --git a/systemd/misc-x@.service b/systemd/misc-x@.service index f4dc161..1a328dd 100644 --- a/systemd/misc-x@.service +++ b/systemd/misc-x@.service @@ -1,5 +1,5 @@ [Unit] -Description=Miscellaneous settings for X11 +Description=Miscellaneous settings for X11 on %I PartOf=graphical-session@%i.target [Service] diff --git a/systemd/nm-applet@.service b/systemd/nm-applet@.service index bd2e4d3..a216161 100644 --- a/systemd/nm-applet@.service +++ b/systemd/nm-applet@.service @@ -1,5 +1,5 @@ [Unit] -Description=Network Manager applet +Description=Network Manager applet for %I PartOf=graphical-session@%i.target [Service] diff --git a/systemd/policykit-agent@.service b/systemd/policykit-agent@.service index a4ec080..f0e7c0c 100644 --- a/systemd/policykit-agent@.service +++ b/systemd/policykit-agent@.service @@ -1,5 +1,5 @@ [Unit] -Description=PolicyKit authentication agent +Description=PolicyKit authentication agent on %I PartOf=graphical-session@%i.target [Service] diff --git a/systemd/redshift@.service b/systemd/redshift@.service index a05fec4..d2c8267 100644 --- a/systemd/redshift@.service +++ b/systemd/redshift@.service @@ -1,5 +1,5 @@ [Unit] -Description=Set color temperature +Description=Set color temperature on %I PartOf=graphical-session@%i.target [Service] diff --git a/systemd/xiccd@.service b/systemd/xiccd@.service index 13ecf0b..10fb01b 100644 --- a/systemd/xiccd@.service +++ b/systemd/xiccd@.service @@ -1,5 +1,5 @@ [Unit] -Description=X color management +Description=X color management for %I PartOf=graphical-session@%i.target [Service] diff --git a/systemd/xsession@.target b/systemd/xsession@.target index 8cc0adc..7614d8b 100644 --- a/systemd/xsession@.target +++ b/systemd/xsession@.target @@ -1,3 +1,3 @@ [Unit] -Description=X session managed by systemd +Description=X session on %I BindsTo=graphical-session@%i.target diff --git a/systemd/xsettingsd@.service b/systemd/xsettingsd@.service index a05e6fc..c28756e 100644 --- a/systemd/xsettingsd@.service +++ b/systemd/xsettingsd@.service @@ -1,5 +1,5 @@ [Unit] -Description=XSETTINGS daemon +Description=XSETTINGS daemon for %I PartOf=graphical-session@%i.target [Service] diff --git a/systemd/xss-lock@.service b/systemd/xss-lock@.service index f217d27..ec10b3a 100644 --- a/systemd/xss-lock@.service +++ b/systemd/xss-lock@.service @@ -1,5 +1,5 @@ [Unit] -Description=Manage X screen saver +Description=Manage X screen saver on %I PartOf=graphical-session@%i.target [Service]