47 lines
1.2 KiB
Markdown
47 lines
1.2 KiB
Markdown
---
|
|
title: "Linux Move Cursor With Keyboard"
|
|
date: 2020-06-21T22:01:35-07:00
|
|
draft: false
|
|
tags: ["X11","xdotool","cursor","keyboard","keyboard shortcuts"]
|
|
authors: ["trent"]
|
|
---
|
|
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:
|
|
```console
|
|
xdotool mousemove_relative -- -1 0
|
|
```
|
|
* move the cursor one pixel right:
|
|
```console
|
|
xdotool mousemove_relative -- 1 0
|
|
```
|
|
* move the cursor one pixel up:
|
|
```console
|
|
xdotool mousemove_relative -- 0 -1
|
|
```
|
|
* move the cursor one pixel down:
|
|
```console
|
|
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-up++
|
|
|
|
++ctrl+super+arrow-down++
|
|
|
|
++ctrl+super+arrow-left++
|
|
|
|
++ctrl+super+arrow-right++
|
|
|
|
combinations to be convenient in the Mate Desktop. Enjoy!
|