Multi-Button Mouse Configuration

Introduction

Anyone using a mouse with extra (such as thumb) buttons probably knows just how convenient those buttons can be.  They also probably know how frustrating it can be when those buttons don't work.  I have several such mice myself, with a thumb button that I could program under Windows to issue the "Back" command to web browsers and Windows Explorer, and this is one of the conveniences that I sorely missed when switching to Linux.

Well, four years later I've finally figured out how to get this working under Linux.  This is definitely more complicated than it should have to be, but at least it works.  This document is intended to provide detailed instructions for setting this up on your own.

Please note that while this is written specifically for the Logitech Mouseman series (since that is what I own), these same steps will apply for all such mice.  See below for additional information.

Return to top

Prerequisites

  • mouse with more than three buttons
  • working XFree86 configuration

Return to top

Applications

Return to top

Installation

IMWheel is the only thing you'll need to install.  Grab the latest version from the link above, and extract the contents to your hard drive.  Install it with the following commands:

$ ./configure
$ make
$ make install

Return to top

Configuration

The first thing to take care of is your X configuration.  Edit your /etc/X11/XF86Config file and look for your mouse device section.  It should look similar to the following:

/etc/X11/XF86Config:
<SNIP>
Section "InputDevice"
   Identifier "mouse0"
   Driver "mouse"
   Option "Device" "/dev/mouse"
   Option "Protocol" "ExplorerPS/2"
   Option "Buttons" "6"
   Option "ZAxisMapping "5 6"
   ...
EndSection
<SNIP>

It's okay if your Device and Identifier parameters are different - these options are very system dependent.  You should, however, change your Protocol, Buttons, and ZAxisMapping parameters to what I have above.  This tells X that you have a 6 button mouse, and to recognize wheel scrolling (forward and backward) as buttons 5 and 6.

Now we need to configure IMWheel.  First of all, search to see if you already have an imwheelrc file.  It's usually in /etc/X11/, but it may be different.  If you find the file, copy it to imwheelrc.bak and then overwrite the original with the code below.  If you don't find one, create an imwheelrc file in /usr/local/etc/ and add the following to it:

/etc/X11/imwheelrc:
".*"
None, Up, Alt_L|Left

"(null)"
None, Up, Alt_L|Left

Note that this will basically map <Alt>-L to your thumb button, which is the key combination most browsers recognize as the "back" command.  Modify this line if you want to change the functionality of the button.

Return to top

Usage

Now that everything is configured, we need to make sure it's always enabled when you start X.  If you type startx to launch X, create/modify your ~/.xinitrc to look similar to this:

~/.xinitrc:
xmodmap -e "pointer = 1 2 3 6 4 5"
imwheel -k -b "6"
exec startkde

If you use a display manager instead, you'll need to modify the session config file for whichever display manager you use. In my case:

/etc/X11/Sessions/kde-3.0.5a:
xmodmap -e "pointer = 1 2 3 6 4 5"
imwheel -k -b "6"
/usr/kde/3/bin/startkde

Note that this is for KDM with KDE 3.0.5.  The XDM and GDM config files are probably in different locations.

That should be it.  Start (or restart) X and you should be able to use the wheel to scroll up and down, and use your thumb button to navigate back in browsers (like Mozilla) and file managers (like Konqueror) that support it.

As I mentioned above, this document is specifically written for the 4 button Logitech Mouseman and to make the thumb button issue the "back" command.  This same process can be used to configure other mice as well (such as the 5 button IntelliMouse Explorer), or to set the functionality of the thumb button to something else.  See http://forums.gentoo.org/viewtopic.php?t=21251 for a more thorough discussion.  This is the main resource I used to configure it myself, so it's definitely worth a read.

I hope you've found this document helpful.  Please e-mail me if you find any mistakes, or if you know of a way to make the process easier.  Enjoy!

Return to top