aboutsummaryrefslogtreecommitdiffstats
path: root/roles/_workstation/sleep/templates/user-sleep@.service.j2
diff options
context:
space:
mode:
Diffstat (limited to 'roles/_workstation/sleep/templates/user-sleep@.service.j2')
-rw-r--r--roles/_workstation/sleep/templates/user-sleep@.service.j217
1 files changed, 17 insertions, 0 deletions
diff --git a/roles/_workstation/sleep/templates/user-sleep@.service.j2 b/roles/_workstation/sleep/templates/user-sleep@.service.j2
new file mode 100644
index 0000000..34d404d
--- /dev/null
+++ b/roles/_workstation/sleep/templates/user-sleep@.service.j2
@@ -0,0 +1,17 @@
+# managed by Ansible
+
+[Unit]
+Description=sleep.target of a systemd user session
+Before=suspend.target sleep.target hibernate.target
+StopWhenUnneeded=yes
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/systemctl --user start suspend.target
+ExecStop=/usr/bin/systemctl --user stop suspend.target
+User=%I
+Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%I/bus
+RemainAfterExit=yes
+
+[Install]
+WantedBy=suspend.target sleep.target hibernate.target
remember that computers suck.