always adjust screen brightness on lock

This commit is contained in:
Pig Monkey 2016-03-20 13:16:54 -07:00
parent 0e0ba1fa68
commit b4c70afa3b
3 changed files with 22 additions and 4 deletions

17
roles/screensaver/files/lock.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
hash light 2> /dev/null
if [ $? -eq 0 ]; then
BRIGHTNESS=true
fi
if ! pidof physlock > /dev/null; then
if [ "$BRIGHTNESS" = true ]; then
light -O
light -S 10
fi
/usr/sbin/physlock -m
if [ "$BRIGHTNESS" = true ]; then
light -I
fi
fi

View file

@ -2,7 +2,5 @@
# {{ ansible_managed }}
if [ "$1" = "post" ]; then
if ! pidof physlock > /dev/null; then
/usr/sbin/physlock -m
fi
/usr/local/bin/lock
fi

View file

@ -7,5 +7,8 @@
tags:
- aur
- name: Push lock script
copy: src=lock.sh dest=/usr/local/bin/lock mode=0755
- name: Push sleep lock script
template: src=lock.sh.j2 dest=/usr/lib/systemd/system-sleep/lock.sh mode=755
copy: src=sleeplock.sh dest=/usr/lib/systemd/system-sleep/lock.sh mode=0755