center-pointer 443 B

12345678910111213141516
  1. #!/bin/sh
  2. HERE=`xdotool getwindowfocus`
  3. ULX=`xwininfo -id $HERE | grep " Absolute upper-left X:" | awk '{print $4}'`
  4. ULY=`xwininfo -id $HERE | grep " Absolute upper-left Y:" | awk '{print $4}'`
  5. # If there is no window, ULX == 1 and ULY == 1.
  6. if [ $ULX != "-1" -o $ULY != "-1" ]; then
  7. eval `xdotool getwindowgeometry --shell $HERE`
  8. NX=`expr $WIDTH / 2`
  9. NY=`expr $HEIGHT / 2`
  10. xdotool mousemove --window $WINDOW $NX $NY
  11. fi