Remapping mouse buttons

Yesterday I got a new mouse. A Logitech G5. Being a nice mouse overall it has a small little flaw: clicking the mouse wheel is not that easy because you can click it in three ways. Down and from left and right.

As I frequently use the middle mouse button I was not happy (because it often misinterpreted a click for a wiggle-left). As a geek I thought: wiggling the mouse wheel to the left is even easier than clicking on it. I would no longer have to lift my finger off the left mouse button. The question was: How can I remap this 7th mouse button?

After some research I found it was very easy to remap the button.

First you have to correctly configure the mouse in your Xorg configuration file:

Section "InputDevice"
Identifier "Logitech G5"
Driver "evdev"
Option "CorePointer"
Option "Device" "/dev/input/by-id/usb-Logitech_USB_Gaming_Mouse-event-mouse"
Option "ZAxisMapping" "invert"
Option "Emulate3Buttons" "false"
Option "Buttons" "9"
Option "Resolution" "800"

(My thanks go to chuck)

From there it took a bit more research to learn that I can use xmodmap  to easily remap the mouse buttons:

xmodmap -e "pointer = 1 7 3 4 5 6 2 8 9"

Remaps button 7 into the poistion of button 2 ( mouse- wheel-click). For more information visit the very good tutorial by HP.

Now I just had to put the “pointer = 1 7 3 4 5 6 2 8 9” part into a file into my home directory (surprisingly called .Xmodmap) and let Fluxbox execute it at startup.

Now I just have to get used to other mice not worknig like that ;-)