PADDING=50 eval $( xdotool getwindowgeometry --shell $( xdotool getactivewindow ) | \ xargs printf "export %s\n" ) eval $( xdotool getmouselocation --shell | \ xargs printf "export MOUSE%s\n" ) case "$1" in "top") xdotool mousemove $MOUSEX $(($Y + $PADDING)) ;; "bottom") xdotool mousemove $MOUSEX $(($Y + $HEIGHT - $PADDING)) ;; "left") xdotool mousemove $(($X + $PADDING)) $MOUSEY ;; "right") xdotool mousemove $(($X + $WIDTH - $PADDING)) $MOUSEY ;; esac