dotfiles/lock.sh
2019-07-26 16:39:37 +01:00

15 lines
472 B
Bash
Executable file

#!/usr/bin/env bash
set -e
set -o pipefail
export PRIMARY_DISPLAY="$(xrandr | awk '/ primary/{print $1}')"
xset s off
xset -dpms
xidlehook \
--not-when-fullscreen \
--not-when-audio \
--timer normal 120 'xrandr --output "$PRIMARY_DISPLAY" --brightness .1' 'xrandr --output "$PRIMARY_DISPLAY" --brightness 1' \
--timer normal 300 'xrandr --output "$PRIMARY_DISPLAY" --brightness 1; systemctl suspend' 'xrandr --output "$PRIMARY_DISPLAY" --brightness 1'