2023-03-12 13:48:16 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-06-17 00:03:57 -04:00
|
|
|
START_TIME=`date +"%b %d, %Y %T"`
|
|
|
|
LOG_FILE="${XDG_STATE_HOME}"/xidlehook.log
|
|
|
|
|
|
|
|
echo "--- ${START_TIME} ---" > "$LOG_FILE"
|
|
|
|
|
2023-03-12 13:48:16 -04:00
|
|
|
# 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
|
2023-06-17 00:03:57 -04:00
|
|
|
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' \
|
|
|
|
2>&1 | tee -a "$LOG_FILE" & disown
|