Browse Source

lockscreen managed by home role

pull/1/head
parent
commit
13dd901aed
11 changed files with 65 additions and 17 deletions
  1. +6
    -4
      defaults/main.yaml
  2. +2
    -0
      files/bin/screensaver
  3. +2
    -0
      tasks/apt.yaml
  4. +6
    -0
      tasks/clean.yaml
  5. +17
    -0
      tasks/lockscreen.yaml
  6. +3
    -1
      tasks/main.yaml
  7. +0
    -7
      tasks/screensaver.yaml
  8. +4
    -4
      templates/i3/i3.config.j2
  9. +5
    -0
      templates/lockscreen/lockscreen.env.j2
  10. +14
    -0
      templates/lockscreen/lockscreen.service.j2
  11. +6
    -1
      templates/x11/xsession.reload.fish.j2

+ 6
- 4
defaults/main.yaml View File

@@ -45,10 +45,12 @@ system_suspend_command: systemctl suspend
system_reboot_command: systemctl reboot
system_poweroff_command: systemctl poweroff

session_lock_enabled: "{{ (home_profile != 'presentation') and (home_profile != 'vdesk') }}"
session_lock_command: xset s activate
session_enable_screensaver_command: /usr/local/bin/screensaver-enable
session_disable_screensaver_command: /usr/local/bin/screensaver-disable
lockscreen_enabled: "{{ (home_profile != 'presentation') and (home_profile != 'vdesk') }}"
lockscreen_lock_command: xset s activate
lockscreen_timeout: 300
lockscreen_locktime: 30

display_sleeptime: 300

file_browser_command: thunar
calculator_command: "{{default_browser}} --new-window https://www.geogebra.org/calculator"


+ 2
- 0
files/bin/screensaver View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec /usr/libexec/xscreensaver/glmatrix -density 50 -no-rotate $@

+ 2
- 0
tasks/apt.yaml View File

@@ -5,3 +5,5 @@
pkg:
- socat
- fish
- xsecurelock
- xss-lock

+ 6
- 0
tasks/clean.yaml View File

@@ -62,3 +62,9 @@
path: ~/.config/systemd/user/autostart-desktop-app@.service
state: absent
notify: systemd daemon-reload

- name: screensaver graphical-session service disabled
systemd:
name: screensaver.service
enabled: false
scope: user

+ 17
- 0
tasks/lockscreen.yaml View File

@@ -0,0 +1,17 @@
---

- name: lockscreen environment
template:
src: lockscreen/lockscreen.env.j2
dest: ~/.lockscreen.env

- name: lockscreen graphical-session service
template:
src: lockscreen/lockscreen.service.j2
dest: ~/.config/systemd/user/lockscreen.service

- name: lockscreen graphical-session service enabled
systemd:
name: lockscreen.service
enabled: "{{ lockscreen_enabled }}"
scope: user

+ 3
- 1
tasks/main.yaml View File

@@ -6,7 +6,6 @@
- import_tasks: ssh.yaml
- import_tasks: tmux.yaml
- import_tasks: pulseaudio.yaml
- import_tasks: screensaver.yaml
- import_tasks: git.yaml
- import_tasks: timer.yaml

@@ -18,6 +17,9 @@
- import_tasks: i3.yaml
tags:
- i3
- import_tasks: lockscreen.yaml
tags:
- lockscreen
- import_tasks: workspaces.yaml
- import_tasks: icons.yaml
- import_tasks: background.yaml


+ 0
- 7
tasks/screensaver.yaml View File

@@ -1,7 +0,0 @@
---

- name: screensaver graphical-session service enabled
systemd:
name: screensaver.service
enabled: "{{ session_lock_enabled }}"
scope: user

+ 4
- 4
templates/i3/i3.config.j2 View File

@@ -22,7 +22,7 @@ floating_modifier $mod
### default/local mode

## special keys
bindsym XF86Sleep exec {{i3_exec_command_prefix}} {{session_lock_command}}
bindsym XF86Sleep exec {{i3_exec_command_prefix}} {{lockscreen_lock_command}}
bindsym XF86Mail exec {{i3_exec_command_prefix}} {{mail_command}}
bindsym XF86HomePage exec {{i3_exec_command_prefix}} {{default_browser}}
bindsym XF86Calculator exec {{i3_exec_command_prefix}} {{calculator_command}}
@@ -173,7 +173,7 @@ bindsym $mod+KP_Add exec {{points_up_command}}
mode "remote" {

bindcode $mod+9 mode "default"
bindsym XF86Sleep exec {{session_lock_command}}
bindsym XF86Sleep exec {{lockscreen_lock_command}}

# The middle button over a titlebar kills the window
bindsym --release button2 kill
@@ -200,8 +200,8 @@ mode "session" {
bindsym r reload; exec --no-startup-id ~/.xsession.reload.fish; mode "default"; {{on_focus_workspace}}
bindsym R reload; exec --no-startup-id ~/.xsession.reload.fish; mode "default"; {{on_focus_workspace}}
bindsym s exec --no-startup-id {{system_suspend_command}}; mode "default"; {{on_focus_workspace}}
bindsym l exec --no-startup-id {{session_lock_command}}; mode "default"; {{on_focus_workspace}}
bindcode 49 exec --no-startup-id {{session_lock_command}}; mode "default"; {{on_focus_workspace}}
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 e exec --no-startup-id {{session_enable_screensaver_command}}; mode "default"; {{on_focus_workspace}}
bindsym d exec --no-startup-id {{session_disable_screensaver_command}}; mode "default"; {{on_focus_workspace}}
bindsym b exec --no-startup-id xsetroot -solid black; mode "default"; {{on_focus_workspace}}


+ 5
- 0
templates/lockscreen/lockscreen.env.j2 View File

@@ -0,0 +1,5 @@
{{ ansible_managed | comment }}

XSECURELOCK_SAVER=%h/bin/screensaver
XSECURELOCK_AUTH_BACKGROUND_COLOR={{home_base_color_hue|hsv2rgb(66,47)}}
XSECURELOCK_SWITCH_USER_COMMAND=dm-tool switch-to-greeter

+ 14
- 0
templates/lockscreen/lockscreen.service.j2 View File

@@ -0,0 +1,14 @@
{{ ansible_managed | comment }}

[Unit]
Description=Screensaver
PartOf=graphical-session.target

[Service]
Type=simple
ExecStart=/usr/bin/xss-lock -l -- xsecurelock
Restart=always
EnvironmentFile=%h/.lockscreen.env

[Install]
WantedBy=graphical-session.target

+ 6
- 1
templates/x11/xsession.reload.fish.j2 View File

@@ -20,7 +20,12 @@ xrdb -merge ~/.Xresources
rofi -theme ~/.config/rofi/theme -dump-xresources > ~/.config/rofi/config

# screensaver settings
/usr/local/bin/screensaver-settings
xset s on
xset +dpms
xset s {{ lockscreen_timeout | int }} {{ lockscreen_locktime | int }}

# DPMS options
xset dpms {{ display_sleeptime | int }} {{ display_sleeptime | int }} {{ display_sleeptime | int }}

# allow hosts
{% for xhost in home_xhosts_allow %}