Move long xidlehook command for laptops to script

This commit is contained in:
Andrew Scott 2023-03-12 13:48:16 -04:00
parent 48177ecef0
commit 0507ec52ae
Signed by: a
GPG key ID: 7CD5A5977E4931C1
2 changed files with 11 additions and 1 deletions

View file

@ -72,7 +72,7 @@ xsettingsd &
$HOME/.local/bin/pipewire-launcher & $HOME/.local/bin/pipewire-launcher &
{{- end }} {{- end }}
{{- if (or (eq .chezmoi.hostname "helix") (eq .chezmoi.hostname "triangulum")) }} {{- if (or (eq .chezmoi.hostname "helix") (eq .chezmoi.hostname "triangulum")) }}
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 480 "xset s activate" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" --timer 3600 "loginctl suspend" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" & $HOME/.local/bin/xidlehook-laptop &
cbatticon -u 20 -i standard -c "loginctl suspend" & cbatticon -u 20 -i standard -c "loginctl suspend" &
$HOME/.local/bin/tint2-launcher & $HOME/.local/bin/tint2-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
# dim screen after 2 minutes, lock screen after 10, suspend after an hour
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 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" &