Explorar el Código

screensaver automatic lock with xss-lock

master
padre
commit
9c0d4149d2
Se han modificado 3 ficheros con 55 adiciones y 1 borrados
  1. +6
    -0
      tasks/main.yaml
  2. +48
    -0
      templates/screensaver-lock.sh.j2
  3. +1
    -1
      templates/screensaver-start.sh.j2

+ 6
- 0
tasks/main.yaml Ver fichero

@@ -45,6 +45,12 @@
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:


+ 48
- 0
templates/screensaver-lock.sh.j2 Ver fichero

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

# Example locker script -- demonstrates how to use the --transfer-sleep-lock
# option with a fixed delay to give simple lockers a little bit of time to lock
# the screen before the system goes the sleep.

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

# Command to start the locker (should not fork)
locker="mate-screensaver-command -l"

# Delay in seconds. Note that by default systemd-logind allows a maximum sleep
# delay of 5 seconds.
sleep_delay=1

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

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

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

pre_lock

# kill locker if we get killed
trap 'kill %%' TERM INT

if [[ -e /dev/fd/${XSS_SLEEP_LOCK_FD:--1} ]]; then
# lock fd is open, make sure the locker does not inherit a copy
$locker {XSS_SLEEP_LOCK_FD}<&- &

sleep $sleep_delay

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

wait # for locker to exit

post_lock

+ 1
- 1
templates/screensaver-start.sh.j2 Ver fichero

@@ -3,6 +3,6 @@
/usr/local/bin/screensaver-settings

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

exec mate-screensaver