Wheel Mouse Setup

Getting a wheel mouse to work in Linux has been the source of much frustration for many users. It's really a very simple procedure however. There's a few things you need to keep in mind:


  1. Up to 7 mouse buttons are supported currently (X-4.2.0).
  2. A wheel counts as 2 buttons. That is, scrolling forward counts as one button and scrolling back another button
  3. To access more than the standard 3 buttons and a wheel, additional software is required (imwheel available at freshmeat)
  4. Certain projects are available to provide support for certain specialized mice. Search for your mouse at freshmeat to see if there is explicit support for it. If not, continue with the setup below.




Basic Wheel Mouse Setup



Perform the following steps as root:
  1. Open /etc/X11/XF86Configusing your preferred text editor
  2. Go down to the line: Section "InputDevice"
  3. Change the protocol to "IMPS/2"
  4. Add the line Option "ZAxisMapping" "4 5"
  5. Add the line Option "Buttons" "5"
  6. Save and restart X for the changes to take effect
The IMPS/2 protocol gets the wheel working on PS/2 mice
The ZAxisMapping line activates the wheel as buttons 4 and 5 on the mouse

A sample configuration is listed below:

Section "InputDevice"
    Identifier  "Mouse1"
    Driver  "mouse"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/mouse"
    Option "ZAxisMapping" "4 5"
    Option "Buttons"    "5"





Advanced Wheel Mouse Setup


I've recently acquired a nifty new mouse with 2 wheels and 2 side buttons, for a total of 9 buttons (as recognized by X windows). Sadly, I've only been able to get 7 of the 9 buttons working and to the best of my knowledge, that's the best X-4.2.0 can do.

Getting the first wheel operational is simple, and very similar to the basic configuration above. X detects the second wheel, and I use the imwheel program available at freshmeat to give me customized functionality.

Perform the following steps as root:
  1. Open /etc/X11/XF86Configusing your preferred text editor
  2. Go down to the line: Section "InputDevice"
  3. Change the protocol to "ExplorerPS/2"
  4. Add the line Option "ZAxisMapping" "4 5 6 7"
  5. Add the line Option "Buttons" "7"
  6. Save and restart X for the changes to take effect
  7. If "ExplorerPS/2" fails, try "IMPS/2" (I've read IMPS/2 works, but I haven't had any luck with it)
A Sample configuration is provided below. This configuration works fine for me:

Section "InputDevice"
    Identifier  "Mouse1"
    Driver  "mouse"
    Option "Protocol"    "ExplorerPS/2"
    Option "Device"      "/dev/mouse"
    Option "ZAxisMapping" "4 5 6 7"
    Option "Buttons"    "7"


At this point, your main wheel should provide you with basic scrolling functionality. Your second wheel (or buttons) will apparently seem useless. You can test if they're working by running the xev program. When the program starts, a small white window appears. Move the mouse to that window and click a button. Something similar to the following will be printed out:

ButtonPress event, serial 21, synthetic NO, window 0xe00001,
    root 0x36, subw 0x0, time 2757505345, (48,100), root:(630,155),
    state 0x0, button 6, same_screen YES

The "button 6" in the line above means I clicked the 6th mouse button (scrolling the second wheel forward i.e. the second wheel is working)

You now need to get and install the imwheel program available at freshmeat. This program lets you program how your mouse wheels behave, and you can program the wheels to behave differently in different windows!! For instance, I use the second wheel to switch tabs in mozilla, and use the same wheel to scroll through emails in pine.

Once imwheel is installed, I start it with the command: imwheel -k -b 0067.  This lets my first mouse wheel provide normal scrolling, and lets me program just the second wheel. Read the documentation to find out how to alter this behaviour. Next, modify the /etc/imwheelrc to define how you want your mouse buttons to behave. If the file doesn't exist, you'll find a sample file in the directory where you un-gzipped the imwheel source.

The documentation explains how to set up the configuration file. Very briefly, each line looks similar to the following:

Shift_L, Left, Control_L|Up

The first wheel buttons are "Up" and "Down". The second wheel buttons are "Left" and "Right".  You can use the xev program to determine what codes (keysyms) correspond to what keys.

The line above says "When you hold down the left Shift key on the keyboard and move the second mouse wheel forward, then the key sequence Control-Up is generated"

Edit /etc/imwheelrc and you can make your mouse do all sorts of cool things with this program!!!





Hosted by www.Geocities.ws

1