#!/bin/bash # For monitor 1 2560x1440 btw... (1287, 1055) center1=$(echo "1300 850") center2=$(echo "1250 800") # move to proper spot xdotool mousemove $center1 echo "Program will exit on mouse move..." sleep .5 while [ 1 ]; do xdotool click 1 & sleep 5 mouseLoc=$(xdotool getmouselocation 2>&1 | sed -rn '${s/x:([0-9]+) y:([0-9]+) .*/\1 \2/p}') if [ "$center1" != "$mouseLoc" ] && [ "$center2" != "$mouseLoc" ]; then echo "Mouse moved. Exiting." exit fi # This is messy as hell... but it works, can refine this in the future to make less repetitive... xdotool mousemove $center2 xdotool click 1 & sleep 5 mouseLoc=$(xdotool getmouselocation 2>&1 | sed -rn '${s/x:([0-9]+) y:([0-9]+) .*/\1 \2/p}') if [ "$center1" != "$mouseLoc" ] && [ "$center2" != "$mouseLoc" ]; then echo "Mouse moved. Exiting." exit fi xdotool mousemove $center1 done