mirror of
https://codeberg.org/frosty/dotfiles.git
synced 2024-09-19 03:37:10 -04:00
(runsvdir): add xidlehook service
This commit is contained in:
parent
12d0fc7345
commit
707466fd1b
33
.config/service/xidlehook/run
Executable file
33
.config/service/xidlehook/run
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
|
||||
# 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' \
|
||||
'' \
|
||||
--timer 3600 \
|
||||
'loginctl suspend' \
|
||||
''
|
Loading…
Reference in a new issue