Skip to content

Instantly share code, notes, and snippets.

@mpalourdio
Last active May 5, 2026 07:46
Show Gist options
  • Select an option

  • Save mpalourdio/a0b122a4a689f2877cb79e2fa57161cb to your computer and use it in GitHub Desktop.

Select an option

Save mpalourdio/a0b122a4a689f2877cb79e2fa57161cb to your computer and use it in GitHub Desktop.
Linux: Move mouse randomly every X seconds
#!/bin/bash
DELAY=$1
if [ -z $DELAY ]; then
echo "Error: missing delay -> $0 <delay in seconds>"
exit 1
fi
while true; do
# Get screen dimensions (adjust to your actual screen size)
WIDTH=1920
HEIGHT=1080
# Generate random coordinates
X=$((RANDOM % WIDTH))
Y=$((RANDOM % HEIGHT))
# Move mouse
xdotool mousemove $X $Y
echo "Moved to: $X, $Y at $(date)"
# Wait $DELAY seconds
sleep $DELAY
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment