runsvdir: simplify xidlehook service

This commit is contained in:
frosty 2024-08-25 01:54:31 -04:00
parent 18598b5b7d
commit 0d9e9df555

View file

@ -2,31 +2,11 @@
# shellcheck disable=SC2016
while IFS= read -r line; do
case "$line" in
*primary*)
export PRIMARY_DISPLAY="${line%% *}"
break
;;
esac
done <<EOF
$(xrandr)
EOF
exec xidlehook \
--not-when-fullscreen \
--socket "$XIDLEHOOK_SOCK" \
--timer 600 \
'xrandr --output "$PRIMARY_DISPLAY" --brightness .1' \
'xrandr --output "$PRIMARY_DISPLAY" --brightness 1' \
--timer 10 \
'(
if [ -f "$XDG_CACHE_HOME/lock.png" ]; then
i3lock -i "$XDG_CACHE_HOME/lock.png"
else
i3lock
fi
); xrandr --output "$PRIMARY_DISPLAY" --brightness 1' \
'i3lock -i "$XDG_CACHE_HOME/lock.png"' \
'' \
--timer 3600 \
'loginctl suspend' \