From de23ad58bfd213f3e8c6f3a3b4064c816e0b0882 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Sat, 29 Apr 2023 21:19:59 -0400 Subject: [PATCH] Add xidlehook-desktop, logging for xidlehook scripts --- dot_config/bspwm/executable_bspwmrc.tmpl | 2 +- dot_local/bin/executable_xidlehook-desktop | 10 ++++++++++ dot_local/bin/executable_xidlehook-laptop | 8 +++++--- 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 dot_local/bin/executable_xidlehook-desktop diff --git a/dot_config/bspwm/executable_bspwmrc.tmpl b/dot_config/bspwm/executable_bspwmrc.tmpl index c59ac1b..9e91779 100644 --- a/dot_config/bspwm/executable_bspwmrc.tmpl +++ b/dot_config/bspwm/executable_bspwmrc.tmpl @@ -83,6 +83,6 @@ cbatticon -u 20 -i standard -c "loginctl suspend" & sleep 5 && pa-notify -t 3 & {{- end }} {{- 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 & {{- end }} diff --git a/dot_local/bin/executable_xidlehook-desktop b/dot_local/bin/executable_xidlehook-desktop new file mode 100644 index 0000000..f151044 --- /dev/null +++ b/dot_local/bin/executable_xidlehook-desktop @@ -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 diff --git a/dot_local/bin/executable_xidlehook-laptop b/dot_local/bin/executable_xidlehook-laptop index 62f9e22..13bd6f2 100644 --- a/dot_local/bin/executable_xidlehook-laptop +++ b/dot_local/bin/executable_xidlehook-laptop @@ -4,7 +4,9 @@ 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 +echo "---" | tee -a /tmp/xidlehook.log 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" & + --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 /tmp/xidlehook.log & disown