Remap M720 Mouse Buttons Under Ubuntu

M720 mouse has quite a few buttons. But remapping them under Linux is not necessarily the easiest thing in the world. For example, if one wants Forward and Backward buttons remapped to window left/right snap, there are a few things that need to be done manually.

First we need a few packages:

Terminal
sudo apt install -y xbindkeys xautomation

Then we need to figure out which code our forward and backward keys are:

Terminal
xev | grep -A 2 Button

In my case, these were 8 and 9 respectively.

Then we need to write mappings in ~/.xbindkeysrc:

~/.xbindkeysrc
"xte 'keydown Super_L' 'key Left' 'keyup Super_L'"
b:9

"xte 'keydown Super_L' 'key Right' 'keyup Super_L'"
b:8

And lastly, we need to restart xbindkeys:

Terminal
killall xbindkeys 2>/dev/null
xbindkeys

If all went well, your buttons now know a new trick.

Leave a Reply

Your email address will not be published. Required fields are marked *