New Mouse in Xorg

Last Week I updated my Gentoo box from Xorg 6.x to Modular Xorg 7.0, which is radically different: Xorg now consists of a bunch of small modules instead of a big package.

I didn’t encounter many problems during this upgrade, and you shouldn’t as long as you follow the gentoo migration guide.

This week, I bought a new “gamer” mouse: the Trust “Predator” GM-4200.

Of course, I wanted all buttons to be active and usable in X. So here’s the way I’ve followed to make it working:

First I had to re-emerge Xorg, but with the evdev module integrated. So I added “evdev” into the “INPUT_DEVICES” section of /etc/make.conf:

INPUT_DEVICES=”keyboard evdev mouse wacom”

Then I modified the xorg.conf file:

Section “InputDevice”
Identifier “Mouse1”
Driver “evdev”
Option “Device” “/dev/input/event1”
Option “Buttons” “10”
Option “ZAxisMapping” “4 5”
Option “AlwaysCore” “on”
EndSection

You can see that I defined this mouse with 10 buttons, altough it physically has only 8. In fact, buttons 6 and 7 are automatically assumed as being the left and right wheel tilt (option I don’t have on my mouse). At that point, all my buttons are recognized, but still not usable.

So, finally, I installed xvkbd and xbindkeys, and added the following into my ~/.xbindkeysrc file:

# Back using button 8
“xvkbd -xsendevent -text “\[Alt_L]\[Left]””
b:8
# Forward using button 9
“xvkbd -xsendevent -text “\[Alt_L]\[Right]””
b:9
# Close TAB using button 10
“xvkbd -xsendevent -text “\[Control_L]\[w]””
b:10

After launching xbindkeys (you may want to add it in the automatically started applications), the defined action will be performed after pressing the correspondant mouse button: buttons 8 and 9 navigate backward and forward in Firefox, and button 10 closes active Tab.

Comments are closed.