Browse Source

new screensaver config

master
parent
commit
982308caed
6 changed files with 59 additions and 3 deletions
  1. +14
    -0
      tasks/main.yaml
  2. +1
    -0
      tasks/packages.yaml
  3. +20
    -0
      templates/screensaver-disable.sh.j2
  4. +20
    -0
      templates/screensaver-enable.sh.j2
  5. +3
    -2
      templates/screensaver-lock/i3lock.sh.j2
  6. +1
    -1
      templates/screensaver-settings.sh.j2

+ 14
- 0
tasks/main.yaml View File

@@ -28,3 +28,17 @@
dest: /usr/local/bin/screensaver-lock dest: /usr/local/bin/screensaver-lock
mode: 0755 mode: 0755
when: screensaver != 'none' when: screensaver != 'none'

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

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

+ 1
- 0
tasks/packages.yaml View File

@@ -3,4 +3,5 @@
- name: debian packages - name: debian packages
apt: apt:
pkg: pkg:
- xss-lock
- xssproxy - xssproxy

+ 20
- 0
templates/screensaver-disable.sh.j2 View File

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

# https://www.reddit.com/r/i3wm/comments/6gznzp/lock_screensaver_and_power_saving_how_to_trigger/

xset s on
xset +dpms

# xset s <n1> <n2>
# n1: is the time it takes to launch the first signal that the screen will be
# shutdown. Here we generally dim the screen a bit.
# n2: is the time after n1 that we launch the second signal.
# Here we lock the screen.
# With n1 = 60 and n2 = 30 the screen will be dimmed 60 seconds after the last
# time pc was not idle and 30 seconds later (90 seconds from last non-idle
# state) the screen will be locked.
xset s 0 0

# xset dpms <n>
# n: is the time from last non-idle state after which the screen will be shutdown.
xset dpms 0 0 0

+ 20
- 0
templates/screensaver-enable.sh.j2 View File

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

# https://www.reddit.com/r/i3wm/comments/6gznzp/lock_screensaver_and_power_saving_how_to_trigger/

xset s on
xset +dpms

# xset s <n1> <n2>
# n1: is the time it takes to launch the first signal that the screen will be
# shutdown. Here we generally dim the screen a bit.
# n2: is the time after n1 that we launch the second signal.
# Here we lock the screen.
# With n1 = 60 and n2 = 30 the screen will be dimmed 60 seconds after the last
# time pc was not idle and 30 seconds later (90 seconds from last non-idle
# state) the screen will be locked.
xset s {{ screensaver_sleeptime | int * 60 }} {{ screensaver_locktime | int * 60 }}

# xset dpms <n>
# n: is the time from last non-idle state after which the screen will be shutdown.
xset dpms {{ screensaver_sleeptime | int * 60 }} {{ screensaver_sleeptime | int * 60 }} {{ screensaver_sleeptime | int * 60 }}

+ 3
- 2
templates/screensaver-lock/i3lock.sh.j2 View File

@@ -6,16 +6,17 @@
## CONFIGURATION ############################################################## ## CONFIGURATION ##############################################################


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


# Run before starting the locker # Run before starting the locker
pre_lock() { pre_lock() {
#mpc pause
xset dpms force off
return return
} }


# Run after the locker exits # Run after the locker exits
post_lock() { post_lock() {
/usr/local/bin/screensaver-enable
return return
} }




+ 1
- 1
templates/screensaver-settings.sh.j2 View File

@@ -17,4 +17,4 @@ xset s {{ screensaver_sleeptime | int * 60 }} {{ screensaver_locktime | int * 60


# xset dpms <n> # xset dpms <n>
# n: is the time from last non-idle state after which the screen will be shutdown. # n: is the time from last non-idle state after which the screen will be shutdown.
xset dpms {{ screensaver_sleeptime | int * 60 }}
xset dpms {{ screensaver_sleeptime | int * 60 }} {{ screensaver_sleeptime | int * 60 }} {{ screensaver_sleeptime | int * 60 }}