-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrandom_mouse.sh
More file actions
executable file
·31 lines (27 loc) · 845 Bytes
/
random_mouse.sh
File metadata and controls
executable file
·31 lines (27 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
_display_help() {
printf "This script randomly moves the mouse cursor on the screen\n"
printf "USAGE:\n"
printf "\tbash ${script_name} [min_sleep] [max sleep]\n"
printf "EXAMPLE:"
printf "\n\tbash ${script_name} 1 3600\n"
printf "PARAMETERS:\n"
printf "\t[min_sleep]\tMinimal sleep time between random moves (in seconds)\n"
printf "\t[max_sleep]\tMaximal sleep time between random moves (in seconds)\n"
}
script_name=$0
sleep_min=$1
sleep_max=$2
if [ -z "${sleep_min}" ] || [ -z "${sleep_max}" ]; then
_display_help
exit 1
fi
while true; do
angle=$(shuf -i 0-360 -n 1)
distance=$(shuf -i 0-100 -n 1)
sleep=$(shuf -i $sleep_min-$sleep_max -n 1)
for (( i=0; i<$distance; i++ )); do
xdotool mousemove_relative --polar $angle 10
done
sleep $sleep
done