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