Skip to content

Instantly share code, notes, and snippets.

@vyder
Last active August 29, 2015 14:02
Show Gist options
  • Save vyder/d47a0979ab61d03b003f to your computer and use it in GitHub Desktop.
Save vyder/d47a0979ab61d03b003f to your computer and use it in GitHub Desktop.
Wiggle the mouse/cursor every now and then to prevent the screen saver from activating
#!/usr/bin/env bash
#
# 1. Install 'xdotool' - http://www.semicomplete.com/projects/xdotool/
# sudo apt-get install xdotool
# 2. Open a screen session:
# screen -S mouse_wiggle
# 3. Exec this script
# 4. Background the session with Ctrl+A+D
#
# Not sure why we need this,
# but it complains if this
# variable isn't set
export DISPLAY=':0.0'
# Format:
# Number + (s|m|h|d)
sleep_period=2m
while true; do
echo "Twitching mouse at: "
date
echo "---"
xdotool mousemove 0 100
xdotool mousemove 0 50
sleep ${sleep_period}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment