]> git.rmz.io Git - dotfiles.git/commitdiff
systemd: add user suspend.target
authorSamir Benmendil <me@rmz.io>
Tue, 31 Oct 2023 22:01:20 +0000 (22:01 +0000)
committerSamir Benmendil <me@rmz.io>
Tue, 31 Oct 2023 23:08:51 +0000 (23:08 +0000)
systemd/system/suspend@.service [new file with mode: 0644]
systemd/user/suspend.target [new file with mode: 0644]

diff --git a/systemd/system/suspend@.service b/systemd/system/suspend@.service
new file mode 100644 (file)
index 0000000..addaeb9
--- /dev/null
@@ -0,0 +1,12 @@
+# Proxy the system suspend.target to a users suspend.target. Enable with:
+#    systemctl enable suspend@$(whoami)
+[Unit]
+Description=Call user's suspend target when system suspends
+After=suspend.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/systemctl --user --machine=%i@ start --wait suspend.target
+
+[Install]
+WantedBy=suspend.target
diff --git a/systemd/user/suspend.target b/systemd/user/suspend.target
new file mode 100644 (file)
index 0000000..6aba376
--- /dev/null
@@ -0,0 +1,3 @@
+[Unit]
+Description=User suspend target
+StopWhenUnneeded=yes