aboutsummaryrefslogtreecommitdiff
path: root/scripts/util/afk.sh
diff options
context:
space:
mode:
authorben <ben@nagy.contact>2025-05-03 14:41:13 -0700
committerben <ben@nagy.contact>2025-05-03 14:41:13 -0700
commitea687c769521b3139c8547a2d4a839842fa7b0fe (patch)
treef4805588bb59ca15e96d8b71124c4aafd5dd40cb /scripts/util/afk.sh
parent16725b034eeb7122f4174f08221ab7f07b6abbf1 (diff)
added scripts
Diffstat (limited to 'scripts/util/afk.sh')
-rwxr-xr-xscripts/util/afk.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/util/afk.sh b/scripts/util/afk.sh
new file mode 100755
index 0000000..a189dd5
--- /dev/null
+++ b/scripts/util/afk.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# TODO: for dunst, we need to create a watchdog process
+
+# Prevent screen from sleeping or trick websites to think you're present while afk
+
+dzen_opts="-bg white -fg black -p 1 -x -475 -y 50 -w 475 -h 50"
+message="Away from keyboard for ~$1 minutes"
+
+#[[ $(pgrep dunst) ]] && dunstctl set-paused true
+while true; do
+ for direction in "10 0" "0 10" "-10 0" "0 -10"; do # move around
+ xdotool mousemove_relative -- $direction
+ printf '%s\n' "$message" | dzen2 $dzen_opts
+ done
+
+ xdotool mousemove 2880 540 # someplace near the middle
+done
+
+#[[ $(pgrep dunst) ]] && dunstctl set-paused false
+rm "$PID_FILE"