Howdy. Thought I'd do a quick post to help everybody who's having trouble getting their extra mouse buttons working. I'm working with an IntelliMouse Optical 1.1A, but I've done some research to try and make the following work with other mice. Here's what you need to do:
1) Edit /etc/X11/XF86Config
The relevant section is InputDevice
Mine looks like this:
Code:
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "ExplorerPS/2"
Option "Device" "/dev/input/mice"
Option "Buttons" "7"
Option "ZAxisMapping" "6 7"
Option "Emulate3Buttons" "no"
EndSection
Do not change your "Identifier," that is specific to your configuration. You should make sure you have "Buttons" "ZAxisMapping" and "Protocol" all set to the above values. IMPS/2 may work also, but even for "non-explorer" intellimice, ExplorerPS/2 should work fine. This is for USB mice also, PS/2 is just part of the name, it does not mean that you have a PS/2 mouse. There are seven buttons on what appear to be five-button mice: left button, right button, middle button (push down on scroll wheel), scroll up, scroll down, side button 1, side button 2.
2) Restart X
The above changes do not take effect until you have restarted X. You can do this by typing the following as root:
3) Run xmodmap
The following should work for almost all cases:
Code:
xmodmap -e "pointer = 1 2 3 6 7 4 5"
You must have the -e option, or it will not work. This command sets the index numbers for the buttons of your mouse. Because we are still just testing, we won't add this to a startup file yet, but note that you'll want to perform the following commands without restarting X. If you do restart X, be sure to re-run the above command.
4) Check that the buttons are working by using xev
You do not need to be root. Run xev from within a console, and move your mouse to within the new window. Being careful not to move the mouse, press one of your side buttons. There should be output in the terminal both when your press the button and when you release it. Check your other side button. If there is no output, there is something wrong with either your X config file (/etc/X11/XF86Config) or with your xmodmap command line.
5) Download and install imwheel
I am using version 1.0.0pre5, which you can find here:
[REMOVED DUE TO SOME SILLY 5-POST REQUIREMENT -- Search for imwheel in google, it is the first result, and download the most recent release]
You install it just like you do any other tarballed source:
Code:
tar xzvf imwheel-1.0.0pre5.tar.gz
cd imwheel-1.0.0pre5
./configure
make
su -c make\ install
6) Configure imwheel
While you are trying to get this working, you will want to use your user-specific configuration file, located at ~/.imwheelrc . Note that this file will not be read if you run imwheel as root. If you get errors when running imwheel about being unable to create or delete the pid file, add the -p switch to the given command. The first thing you will want to do is figure out what key your side buttons are called by imwheel. To do this, run imwheel --config (no need to be root). A small window will show up. You will see a small picture of a running window, or your desktop, in the new window. What you want to do is figure out which window is pictured. Click on "Grab Wheel Action," and then left-click in the pictured window to give it focused. Click one of your side buttons. Go back to the IMWheel Configuration Helper window, and you should see a line of text, something like Wheel: followed by a direction (Up, Down, Left, Right). Remember this, and close the window.
Edit your configuration file, ~/.imwheelrc. Add the following three lines:
Code:
".*"
None, Left, Alt_L|Left
None, Right, Alt_L|Right
Replace THE FIRST "Left" and "Right" with the directions you recieved from the configurator. You will almost certainly want left/up associated with Alt_L+Left and right/down with Alt_L+Right. Alt + Left arrow and Right arrow are the keyboard shorcuts for back and foward in most web browsers.
7) Run imwheel
Start 'er up, as the user that has .imwheelrc in his/her home directory:
The way that I understand this command to work is that the -b switch lists the keys that are to be assigned the actions in the configuration file. The first line after ".*" is for the first key listed in the -b switch, and the second line after it is for the second key listed, and so on.
Now go to a browser window and try it! If it doesn't work, post your problems, if it does, continue below.
8) Make everything start up automatically
You need to have xmodmap and imwheel start every time you start X. There are different ways to do this on each distribution. On redhat, you'll want to create two files in /etc/X11/xinit/xinitrc.d/ that contain the following (you must be root):
xmodmap:
Code:
#!/bin/sh
xmodmap -e "pointer = 1 2 3 6 7 4 5"
and imwheel:
Code:
#!/bin/sh
imwheel -k -b "67"
Be sure to set these two files executable:
Code:
chmod +x xmodmap imwheel
Other distributions have other meathods, including:
~/.xinitrc
/etc/kde/kdm/Xstartup
/etc/X11/gdm/Sessions/
and many others that I am not aware of. I'm sure if you ask, someone will tell you how best to do it.
9) Move your imwheel configuration to the global config file
Simply copy the lines in your ~/.imwheelrc file, and open /etc/X11/imwheel/imwheelrc. It shouldn't matter where you add them, you'll probably want them right after the description paragraph. You may also want to insert a descriptive, comment, like:
## FOR MOUSE SIDE-BUTTON SUPPORT ##
Save the file, restart your computer, and pray!
That's about it! Good luck!
