dotfiles/nixos/i3/lock.sh

20 lines
432 B
Bash
Raw Normal View History

2019-07-15 20:52:19 +01:00
#!/usr/bin/env bash
2019-07-26 12:41:26 +01:00
set -e
set -o pipefail
2019-07-15 20:52:19 +01:00
export PRIMARY_DISPLAY="$(xrandr | awk '/ primary/{print $1}')"
2019-07-26 12:41:26 +01:00
xset s off
xset -dpms
2020-10-03 20:13:27 +01:00
2019-07-15 20:52:19 +01:00
xidlehook \
--not-when-fullscreen \
--not-when-audio \
2020-10-03 20:13:27 +01:00
--timer 60 \
'xrandr --output "$PRIMARY_DISPLAY" --brightness .1' \
'xrandr --output "$PRIMARY_DISPLAY" --brightness 1' \
--timer 600 \
'xrandr --output "$PRIMARY_DISPLAY" --brightness 1; systemctl suspend' \
''