diff --git a/tasks/lockscreen.yaml b/tasks/lockscreen.yaml index 7f69e74..c7346dc 100644 --- a/tasks/lockscreen.yaml +++ b/tasks/lockscreen.yaml @@ -11,20 +11,21 @@ dest: ~/.screensaver.sh mode: 0755 -- name: lockscreen graphical-session service +- name: lockscreen graphical-session service definition template: src: lockscreen/lockscreen.service.j2 dest: ~/.config/systemd/user/lockscreen.service notify: systemd daemon-reload -- name: lockscreen-auto graphical-session service +- name: lockscreen-auto graphical-session service definition 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 +- name: lockscreen-auto graphical-session service systemd: - name: lockscreen.service - enabled: "{{ lockscreen_enabled }}" + name: lockscreen-auto.service + enabled: "{{ lockscreen_auto_enabled }}" + state: "{{ lockscreen_auto_enabled | ternary('started','stopped') }}" scope: user diff --git a/templates/i3/i3.config.j2 b/templates/i3/i3.config.j2 index aa5c492..aea318a 100644 --- a/templates/i3/i3.config.j2 +++ b/templates/i3/i3.config.j2 @@ -200,8 +200,8 @@ mode "session" { bindsym l exec --no-startup-id {{lockscreen_lock_command}}; mode "default"; {{on_focus_workspace}} bindcode 49 exec --no-startup-id {{lockscreen_lock_command}}; mode "default"; {{on_focus_workspace}} bindsym b exec --no-startup-id xsetroot -solid black; mode "default"; {{on_focus_workspace}} - bindsym e exec --no-startup-id systemctl --user start lockscreen.service; mode "default"; {{on_focus_workspace}} - bindsym d exec --no-startup-id systemctl --user stop lockscreen.service; mode "default"; {{on_focus_workspace}} + bindsym e exec --no-startup-id xset s on; exec --no-startup-id xset dpms {{ display_sleeptime | int }} {{ display_sleeptime | int }} {{ display_sleeptime | int }}; mode "default"; {{on_focus_workspace}} + bindsym d exec --no-startup-id xset s off; exec --no-startup-id xset dpms 0 0 0; mode "default"; {{on_focus_workspace}} bindsym Shift+R exec --no-startup-id {{system_reboot_command}}; mode "default"; {{on_focus_workspace}} bindsym Shift+P exec --no-startup-id {{system_poweroff_command}}; mode "default"; {{on_focus_workspace}} diff --git a/templates/lockscreen/lockscreen.env.j2 b/templates/lockscreen/lockscreen.env.j2 index fe329cc..80a4a8e 100644 --- a/templates/lockscreen/lockscreen.env.j2 +++ b/templates/lockscreen/lockscreen.env.j2 @@ -1,5 +1,6 @@ {{ ansible_managed | comment }} +#XSECURELOCK_SAVER=$HOME/.screensaver.sh XSECURELOCK_AUTH_BACKGROUND_COLOR={{home_base_color_hue|hsv2rgb(66,47)}} XSECURELOCK_SWITCH_USER_COMMAND=dm-tool switch-to-greeter XSECURELOCK_AUTH_TIMEOUT=5 diff --git a/templates/lockscreen/lockscreen.service.j2 b/templates/lockscreen/lockscreen.service.j2 index b288491..d163c01 100644 --- a/templates/lockscreen/lockscreen.service.j2 +++ b/templates/lockscreen/lockscreen.service.j2 @@ -7,8 +7,10 @@ PartOf=graphical-session.target [Service] Type=notify ExecStart=xsecurelock -- systemd-notify --ready +ExecStartPost=xset dpms $XSECURELOCK_AUTH_TIMEOUT $XSECURELOCK_AUTH_TIMEOUT $XSECURELOCK_AUTH_TIMEOUT NotifyAccess=all EnvironmentFile=%h/.lockscreen.env +ExecStopPost=xset dpms {{ display_sleeptime | int }} {{ display_sleeptime | int }} {{ display_sleeptime | int }} [Install] WantedBy=graphical-session.target