How to map right/left click scroll down/up to F1 F2 F3 F4?

Solution 1:

I used xmodmap and xdotool, and I made the best use of them. xmodmap is better for left and right click. Shortcut using xdotool is better for scroll down and up.

I will show all steps to let the user decide which keys and buttons they want to remap.

0 - Discover keys names

With xev you discover:

F1 : keycode 67

F2 : keycode 68

F3 : keycode 69

F4 : keycode 70

Left click: Pointer_Button1

Right click: Pointer_Button3

Scroll Down: Pointer_Button5

Scroll Up: Pointer_Button6

1 - Use F1 and F2 to left and right click

Use xmodmap to really remap keys (better than shortcuts, because it allows drag and drop)

xmodmap -e "keycode 67 = Pointer_Button3"
xmodmap -e "keycode 68 = Pointer_Button1 Pointer_Button1"

This solution derived partially from here.

2 - Create shortcuts for scroll down and up

keyboard > shortcuts > "+" > ...

Scroll down and shortcut F3

xdotool click 5

Scroll up and shortcut F4

xdotool click 4

Restore default configuration of xmodmap:

setxkbmap -option