Skip to content

Linux Move Cursor With Keyboard

date: 2020-06-21T22:01:35-07:00

Introduction

Linux just makes everything so easy. On a laptop it can be tricky to place your mouse cursor on exactly the correct pixel, using the touchpad. This became apparent to myself while using GIMP to create some png button files for a little tkinter project, but there must be other use-cases as well.

xdo commands for moving the cursor

  • move the cursor one pixel left:
    xdotool mousemove_relative -- -1 0
    
  • move the cursor one pixel right:
    xdotool mousemove_relative -- 1 0
    
  • move the cursor one pixel up:
    xdotool mousemove_relative -- 0 -1
    
  • move the cursor one pixel down:
    xdotool mousemove_relative -- 0 1
    

map keyboard shortcuts

Now, in your keyboard settings, map the above commands to new custom shortcuts. For instance, I find the

Ctrl+Super+Up

Ctrl+Super+Down

Ctrl+Super+Left

Ctrl+Super+Right

combinations to be convenient in the Mate Desktop. Enjoy!