There are several ways to control mouse buttons.
I am going to use xbindkeys
(because I know how)
sudo apt-get install xbindkeys
Now, before we can use xbindkeys we need to create its configuration file
xbindkeys --defaults > $HOME/.xbindkeysrc
Now we need to figure out what the number of the mouse button we want to map is. We do this with a program called xev
xev
When we run xev
a small windows will appear. Put your mouse in that window and click the button you want to map. After you press the button several times you should be getting output like:
ButtonRelease event, serial 41, synthetic NO, window 0x4400001, root 0x2e9, subw 0x4400002, time 21579213, (28,34), root:(818,86), state 0x110, button 1, same_screen YES
In this example 'button 1' is the button we want to map.
After we have the name of the button we have two options:
You can map the button to a keyboard shortcut
Or you can map the button to launch an application
To Launch an application:
We need to edit the xbindkeys configuration file:
gedit $HOME/.xbindkeysrc
This will open the xbindkeys configuration file in gedit. (note: If you use another text editor, like kate, substitute 'gedit' for 'kate')
Scroll to the bottom of the file and create a new line.
If you want 'button 1' to open, say, firefox type:
“firefox”
b:1
This will map application 'firefox' to 'button 1'.
To Execute a keyboard shortcut:
We need another application called xte.
sudo apt-get install xautomation
Now we need to edit the xbindkeys configuration file:
gedit $HOME/.xbindkeysrc
Scroll to the bottom of the file and create a new line.
To map 'button 1' to a keyboard shortcut, say, Ctrl+C type:
“xte 'key Ctrl_C' “
b:1
Restart the computer.