From c3d6da08525f2a83ae5e6b2e2efca378794e0835 Mon Sep 17 00:00:00 2001 From: Markus Katharina Brechtel Date: Thu, 6 Jan 2022 20:12:40 +0100 Subject: [PATCH] lockscreen and lockscreen-auto services --- tasks/clean.yaml | 6 ++++++ tasks/lockscreen.yaml | 8 +++++++- templates/lockscreen/lockscreen-auto.service.j2 | 13 +++++++++++++ templates/lockscreen/lockscreen.service.j2 | 7 +++---- 4 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 templates/lockscreen/lockscreen-auto.service.j2 diff --git a/tasks/clean.yaml b/tasks/clean.yaml index 6344576..74db2d7 100644 --- a/tasks/clean.yaml +++ b/tasks/clean.yaml @@ -69,3 +69,9 @@ enabled: false state: stopped scope: user + +- name: lockscreen graphical-session service disabled + systemd: + name: lockscreen.service + enabled: false + scope: user diff --git a/tasks/lockscreen.yaml b/tasks/lockscreen.yaml index 3e596ac..7f69e74 100644 --- a/tasks/lockscreen.yaml +++ b/tasks/lockscreen.yaml @@ -17,7 +17,13 @@ dest: ~/.config/systemd/user/lockscreen.service notify: systemd daemon-reload -- name: lockscreen graphical-session service enabled +- name: lockscreen-auto graphical-session service + template: + src: lockscreen/lockscreen-auto.service.j2 + dest: ~/.config/systemd/user/lockscreen-auto.service + notify: systemd daemon-reload + +- name: lockscreen-auto graphical-session service enabled systemd: name: lockscreen.service enabled: "{{ lockscreen_enabled }}" diff --git a/templates/lockscreen/lockscreen-auto.service.j2 b/templates/lockscreen/lockscreen-auto.service.j2 new file mode 100644 index 0000000..aded42e --- /dev/null +++ b/templates/lockscreen/lockscreen-auto.service.j2 @@ -0,0 +1,13 @@ +{{ ansible_managed | comment }} + +[Unit] +Description=Screensaver +PartOf=graphical-session.target + +[Service] +Type=simple +ExecStart=/usr/bin/xss-lock -l -- systemctl --user start lockscreen.service +Restart=always + +[Install] +WantedBy=graphical-session.target diff --git a/templates/lockscreen/lockscreen.service.j2 b/templates/lockscreen/lockscreen.service.j2 index ae77998..b288491 100644 --- a/templates/lockscreen/lockscreen.service.j2 +++ b/templates/lockscreen/lockscreen.service.j2 @@ -5,11 +5,10 @@ Description=Screensaver PartOf=graphical-session.target [Service] -Type=simple -ExecStart=/usr/bin/xss-lock -l -- xsecurelock +Type=notify +ExecStart=xsecurelock -- systemd-notify --ready +NotifyAccess=all EnvironmentFile=%h/.lockscreen.env -Environment="XSECURELOCK_SAVER=%h/.screensaver.sh" -Restart=always [Install] WantedBy=graphical-session.target