Linux Move Cursor With Keyboard

2020, Jun 21

linux-move-cursor-with-keyboard.svg

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+<arrow>keys to be convenient in the Mate Desktop. Enjoy!

Next
Top
Prev