Skip to content

Instantly share code, notes, and snippets.

@devernay
Created May 6, 2020 18:39
Show Gist options
  • Save devernay/68ea104c8a1322067702127465f3ae2d to your computer and use it in GitHub Desktop.
Save devernay/68ea104c8a1322067702127465f3ae2d to your computer and use it in GitHub Desktop.
Move mouse to prevent screensaver from activating & locking (wiggleme)
#!/bin/bash
# https://www.darklaunch.com/move-mouse-to-prevent-screensaver-from-activating-locking
case $(uname -s) in
Darwin)
timeout=$((10 * 60))
while :; do
last_mouse_position=$(cliclick "p")
sec="${timeout}"
while [[ $sec -ge 0 ]]; do
echo -ne "\r$sec\033[0K"
sec=$((sec-1))
sleep 1
done
echo -ne "\r"
current_mouse_position=$(cliclick "p")
if [[ $last_mouse_position == $current_mouse_position ]]; then
cliclick "m:+1,+0"
cliclick "m:-1,+0"
fi
done
;;
Linux)
# Ubuntu version:
while :; do
xdotool mousemove_relative -- 1 0
sleep 1
xdotool mousemove_relative -- -1 0
sleep 60
done
;;
esac
@p3x-robot
Copy link

it is awesome.
i got the same funcionality:
https://gist.github.com/p3x-robot/0a118205aaab82070ed530f45da95138 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment