Add xidlehook-desktop, logging for xidlehook scripts

This commit is contained in:
Andrew Scott 2023-04-29 21:19:59 -04:00
parent e97a808f38
commit de23ad58bf
Signed by: a
GPG key ID: 7CD5A5977E4931C1
3 changed files with 16 additions and 4 deletions

View file

@ -83,6 +83,6 @@ cbatticon -u 20 -i standard -c "loginctl suspend" &
sleep 5 && pa-notify -t 3 & sleep 5 && pa-notify -t 3 &
{{- end }} {{- end }}
{{- if eq .chezmoi.hostname "hydrus"}} {{- if eq .chezmoi.hostname "hydrus"}}
xidlehook --not-when-audio --not-when-fullscreen --timer 360 "xset s activate" "" & $HOME/.local/bin/xidlehook-desktop &
$HOME/.local/bin/dual-polybar-launcher & $HOME/.local/bin/dual-polybar-launcher &
{{- end }} {{- end }}

View file

@ -0,0 +1,10 @@
#!/bin/bash
# Wait on pipewire or "--not-when-audio" will break everything
until pgrep -u $UID -x pipewire-pulse >/dev/null; do sleep 1; done
# lock screen after 10 minutes
echo "---" | tee -a /tmp/xidlehook.log
xidlehook --not-when-audio --not-when-fullscreen \
--timer 600 "xset s activate" "" \
2>&1 | tee -a /tmp/xidlehook.log & disown

View file

@ -4,7 +4,9 @@
until pgrep -u $UID -x pipewire-pulse >/dev/null; do sleep 1; done until pgrep -u $UID -x pipewire-pulse >/dev/null; do sleep 1; done
# dim screen after 2 minutes, lock screen after 10, suspend after an hour # dim screen after 2 minutes, lock screen after 10, suspend after an hour
echo "---" | tee -a /tmp/xidlehook.log
xidlehook --not-when-audio --not-when-fullscreen \ xidlehook --not-when-audio --not-when-fullscreen \
--timer 120 "killall -q redshift && xrandr --output eDP-1 --brightness .1" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" \ --timer 120 "killall -q redshift && xrandr --output eDP-1 --brightness .1" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" \
--timer 480 "xset s activate" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" \ --timer 480 "xset s activate" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" \
--timer 3000 "loginctl suspend" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" & --timer 3000 "loginctl suspend" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" \
2>&1 | tee -a /tmp/xidlehook.log & disown