How can I map keyboard buttons to my mouse buttons?
Solution 1:
-
Install the package
xautomation
, we need the commandxte
sudo apt-get install xautomation
-
Install the package
x11-utils
, we need the commandxev
sudo apt-get install x11-utils
-
Check the code for the two mouse buttons.
-
Start the command
xev
in a terminal:xev
Move the mouse in the new window
Press your extra mouse buttons
In my case, note the output
button 8
andbutton 9
:ButtonRelease event, serial 36, synthetic NO, window 0x2e00001, root 0x233, subw 0x0, time 9222464, (94,21), root:(1774,85), state 0x10, button 8, same_screen YES ButtonPress event, serial 36, synthetic NO, window 0x2e00001, root 0x233, subw 0x0, time 9223854, (94,21), root:(1774,85), state 0x10, button 9, same_screen YES
-
-
Edit your
xbindkeys
configuration, e.g.:nano ~/.xbindkeysrc
and add the following lines
"xte 'key Home'" b:9 "xte 'key End'" b:8
Replace
b:8
andb:9
with your numbers ofxev
output-
from
man xte
key k Press and release key k keydown k Press key k down keyup k Release key k
-
-
Kill all
kbindkeys
processeskillall xbindkeys
-
Restart
xbindkeys
with your configuration, eg:xbindkeys -f ~/.xbindkeysrc