The problem: my new gift, the Logitech M720 (yes, I know, I’m a nerd 🙂 ) has the middle click wheel with 3 click (one, the actual middle click and the wheel slightly left and right). So, using the middle click to paste from the clipboard is nearly impossible.
The solution: I have installed “xev” to record the click generated by the wheel slightly left and right and mapped the two buttons to the middle click (so in every condition, when I press the middle button – aka the mouse wheel – the middle click is generated). Voilà!
Open the terminal and install all required software (I’m using Ubuntu, so this command can be different if you are using other distributions):
sudo apt-get install xbindkeys xautomation x11-utils
Run “xev” to grab the mouse buttons:
xev -event mouse | grep Button --before-context=1 --after-context=2
The “xev” program will open a small white window when you can go with your mouse and press the buttons you want to remap. The relevant part is the “button 6” or “button 7” (in my case).
ButtonRelease event, serial 25, synthetic NO, window 0x7a00001, root 0x1a2, subw 0x0, time 20850944, (49,117), root:(1756,146), state 0x10, button 7, same_screen YES ButtonPress event, serial 25, synthetic NO, window 0x7a00001, root 0x1a2, subw 0x0, time 20853822, (49,117), root:(1756,146), state 0x10, button 6, same_screen YES
Generate the vanilla “xbindkeys” configuration file:
xbindkeys --defaults > $HOME/.xbindkeysrc
Add the config lines ad bottom of the file:
"xte 'mouseclick 2'" b:7 "xte 'mouseclick 2'" b:6
Reload the “xbindkeys” and enjoy 🙂
Note: your mouse buttons can be mapped differently, so you have to get them via the “xev” program as explained before.