I would like to use keyboard buttons for left and right mouse clicks. I found this answer that describes remapping mouse buttons to keyboard keys. Can I use this method 'in reverse' to map keyboard keys to mouse buttons? E.g. F1 key = left click, F2 key = right click. I'd like the remap to apply on startup.
Asked
Active
Viewed 1,658 times
0
-
This might be helpful to you https://askubuntu.com/questions/9048/how-to-bind-mouse-buttons-to-keys – Utkarsh Chandra Srivastava Mar 22 '22 at 16:34
2 Answers
0
This can be done with xdotool
if you run Xorg. ydotool
will also work on Wayland.
For example, to simulate a mouseclick with the left button:
xdotool click 1 # left click
or
ydotool click left
Bind these commands to a shortcut key, e.g. using "Settings" - "Keyboard" for the default Ubuntu desktop. On xorg
, you can also use hotkey daemons that are independent of the desktop, like xbindkeys
or sxhkd
. Note, however, that these may be unreliable if you switch keyboard layouts, or when the computer wakes from a suspended state.

vanadium
- 88,010
0
You can use the remapper deamon keyd for this purpose. See this answer for installation, usage and tips.
After installation, use the config below.
[ids]
[main]
f1 = leftmouse
f2 = middlemouse
f3 = rightmouse

Rasmus
- 8,375