Browse Source

multiple screensaver options

master
parent
commit
22502c8b0a
9 changed files with 92 additions and 30 deletions
  1. +1
    -1
      defaults/main.yaml
  2. +24
    -3
      tasks/main.yaml
  3. +6
    -0
      tasks/screensavers/i3lock.yaml
  4. +0
    -18
      tasks/screensavers/mate-screensaver.yaml
  5. +51
    -0
      templates/screensaver-lock/i3lock.sh.j2
  6. +0
    -0
      templates/screensaver-lock/mate-screensaver.sh.j2
  7. +0
    -8
      templates/screensaver-start.sh.j2
  8. +5
    -0
      templates/screensaver-start/i3lock.sh.j2
  9. +5
    -0
      templates/screensaver-start/mate-screensaver.sh.j2

+ 1
- 1
defaults/main.yaml View File

@@ -1,5 +1,5 @@
---
screensaver_package: mate-screensaver
screensaver: mate-screensaver
screensaver_locktime: 10
screensaver_theme: screensavers-popsquares
screensaver_sleeptime: "{{screensaver_locktime}}"

+ 24
- 3
tasks/main.yaml View File

@@ -3,7 +3,28 @@
- import_tasks: packages.yaml

- import_tasks: none.yaml
when: screensaver_package == "none"
when: screensaver == 'none'

- import_tasks: screensavers/mate-screensaver.yaml
when: screensaver_package == "mate-screensaver"
- include_tasks: screensavers/{{screensaver}}.yaml
when: screensaver != 'none'

- name: screensaver settings script
template:
src: screensaver-settings.sh.j2
dest: /usr/local/bin/screensaver-settings
mode: 0755
when: screensaver != 'none'

- name: screensaver start script
template:
src: screensaver-start/{{screensaver}}.sh.j2
dest: /usr/local/bin/screensaver-start
mode: 0755
when: screensaver != 'none'

- name: screensaver lock script
template:
src: screensaver-lock/{{screensaver}}.sh.j2
dest: /usr/local/bin/screensaver-lock
mode: 0755
when: screensaver != 'none'

+ 6
- 0
tasks/screensavers/i3lock.yaml View File

@@ -0,0 +1,6 @@
---

- name: debian packages for i3lock
apt:
pkg:
- i3lock

+ 0
- 18
tasks/screensavers/mate-screensaver.yaml View File

@@ -33,24 +33,6 @@
dest: /usr/local/bin/mate-screensaver-helper-inhibition
mode: 0755

- name: screensaver settings script
template:
src: screensaver-settings.sh.j2
dest: /usr/local/bin/screensaver-settings
mode: 0755

- name: screensaver start script
template:
src: screensaver-start.sh.j2
dest: /usr/local/bin/screensaver-start
mode: 0755

- name: screensaver lock script
template:
src: screensaver-lock.sh.j2
dest: /usr/local/bin/screensaver-lock
mode: 0755

- import_role:
name: dconf-lock
vars:


+ 51
- 0
templates/screensaver-lock/i3lock.sh.j2 View File

@@ -0,0 +1,51 @@
#!/bin/bash

# Example locker script -- demonstrates how to use the --transfer-sleep-lock
# option with i3lock's forking mode to delay sleep until the screen is locked.

## CONFIGURATION ##############################################################

# Options to pass to i3lock
i3lock_options="-d -c 000000"

# Run before starting the locker
pre_lock() {
#mpc pause
return
}

# Run after the locker exits
post_lock() {
return
}

###############################################################################

pre_lock

# We set a trap to kill the locker if we get killed, then start the locker and
# wait for it to exit. The waiting is not that straightforward when the locker
# forks, so we use this polling only if we have a sleep lock to deal with.
if [[ -e /dev/fd/${XSS_SLEEP_LOCK_FD:--1} ]]; then
kill_i3lock() {
pkill -xu $EUID "$@" i3lock
}

trap kill_i3lock TERM INT

# we have to make sure the locker does not inherit a copy of the lock fd
i3lock $i3lock_options {XSS_SLEEP_LOCK_FD}<&-

# now close our fd (only remaining copy) to indicate we're ready to sleep
exec {XSS_SLEEP_LOCK_FD}<&-

while kill_i3lock -0; do
sleep 0.5
done
else
trap 'kill %%' TERM INT
i3lock -n $i3lock_options &
wait
fi

post_lock

templates/screensaver-lock.sh.j2 → templates/screensaver-lock/mate-screensaver.sh.j2 View File


+ 0
- 8
templates/screensaver-start.sh.j2 View File

@@ -1,8 +0,0 @@
#!/bin/sh

/usr/local/bin/screensaver-settings

#exec xss-lock -- i3lock -c ff00ff
#xss-lock -l -- /usr/local/bin/screensaver-lock &

exec mate-screensaver

+ 5
- 0
templates/screensaver-start/i3lock.sh.j2 View File

@@ -0,0 +1,5 @@
#!/bin/sh

/usr/local/bin/screensaver-settings

xss-lock -l -- /usr/local/bin/screensaver-lock &

+ 5
- 0
templates/screensaver-start/mate-screensaver.sh.j2 View File

@@ -0,0 +1,5 @@
#!/bin/sh

/usr/local/bin/screensaver-settings

exec mate-screensaver