aboutsummaryrefslogtreecommitdiff
path: root/scripts/util/afk.sh
blob: a189dd50d63f4f0cb3175ef89d480d187b053f3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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"