Configuring Side Buttons on Logitech Mice under Ubuntu Linux

One of the first things I set up on a desktop Linux install is to change the behaviour of the side buttons away from the provided defaults of “Back” and “Forward”. This usually requires some sorting through a mess of old results to find current information.

Here’s a quick guide to changing the side buttons on a 5-button Logitech mouse on Ubuntu 12.04, 12.10, and 13.04, and Linux Mint.

Install necessary packages

$ sudo apt-get install xbindkeys xvkbd

Create a default profile for xbindkeys

$ xbindkeys --defaults > /home/stefan/.xbindkeysrc

Edit the default profile

$ sudo gedit /home/stefan/.xbindkeysrc

Comment out the provided examples to prevent conflicts and strange behaviour.

# Examples of commands:
 
#"xbindkeys_show"
# control+shift + q
 
# set directly keycode (here control + f with my keyboard)
#"xterm"
# c:41 + m:0x4
 
# specify a mouse button
#"xterm"
# control + b:2

Add new entries in .xbindkeysrc for side buttons

The xev1 command will show you the index bound to each of your buttons (8,9). The snippet below worked on the MX500 and M570.

# side button page down
"xvkbd -xsendevent -text "\[Page_Down]""
m:0x0 + b:8

# side button page up
"xvkbd -xsendevent -text "\[Page_Up]""
m:0x0 + b:9

Start ‘xbindkeys’, and confirm that your side buttons are working.

Make your changes take effect on Startup

In Preferences -> Startup Applications, create an entry to run xbindkeys.

Done!

Leave a Reply

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