keep-mouse-movin.sh 🖱️

Published by Alicia's Notes 🚀, View original

Working remotley? Sick and tired of having to get out of bed every 20 minutes to move your mouse, to prevent Slack/ Skype/ Teams from showing your status as Away? Well with a couple lines of bash, you can have your mouse pointer periodically move, ensureing your status will always remain Active. Your boss will be none the wiser

# LENGTH is the amount of px the mouse will move
# 0 = not moving at all, 1 = tiny movement, 100 = giant movement
LENGTH=50

# DELAY is the time period between movements, in seconds
DELAY=5

while true
  do
    for ANGLE in 0 90 180 270
      do
        xdotool mousemove_relative --polar $ANGLE $LENGTH
          sleep $DELAY
      done
    done

The pointer will move around its current position on the screen (i.e where you last placed it). However, if you prefer it to move around the centre of the screen, just change mousemove_relative to mousemove in the xdotool command.