LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 10-26-2003, 01:03 PM   #1
bluephile
Member
 
Registered: Oct 2003
Posts: 45

Rep: Reputation: 15
Lightbulb HOWTO: Get side mouse buttons working


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:
Code:
killall -HUP X
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:
Code:
imwheel -k -b "67"
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!
 
Old 10-26-2003, 06:17 PM   #2
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
Cool - have you thought about posting this in LinuxAnswers?
 
Old 10-26-2003, 10:22 PM   #3
bluephile
Member
 
Registered: Oct 2003
Posts: 45

Original Poster
Rep: Reputation: 15
Never knew about that, thanks! Looks kinda empty but I'll post it there.

Cheers!
 
Old 10-28-2003, 11:25 AM   #4
geloramo
LQ Newbie
 
Registered: Oct 2003
Location: Sao Paulo / Brasil
Distribution: Slack 8.1
Posts: 4

Rep: Reputation: 0
Hey bluephile

I got my whell working but the button 6 n 7 ( my side buttons r not)

button 6 r working as page up n 7 as page down

thanks in advance
 
Old 10-28-2003, 03:46 PM   #5
bluephile
Member
 
Registered: Oct 2003
Posts: 45

Original Poster
Rep: Reputation: 15
Howdy geloramo,

What did you put in your .imwheelrc? If you have something like:
Code:
".*"
None, Up, Alt_L|Left
None, Down, Alt_L|Right
try changing it to:
Code:
".*"
None, Left, Alt_L|Left
None, Right, Alt_L|Right
or vice-versa. So, post your config and the info you get from imwheel --config

Cheers!
 
Old 06-25-2004, 10:33 PM   #6
NWS
LQ Newbie
 
Registered: Jun 2004
Posts: 10

Rep: Reputation: 0
okay, so i've followed this pretty much exactly, and everything works great manually. i don't know what i'm supposed to see after the last "imwheel -k ..." command, but i get the output "imwheel (pid 1868)" or something.

i have a problem with getting it to work automatically however. when i create a file "xmodmap" with the line "xmodmap -e ..."and place it in /etc/X11/xinit/xinitrc.d the scroll wheel works automatically just fine. However, if I add a file "imwheel" and put the command "imwheel -k ..." in the file in the same directory, my screen freezes when i try to login as root. I've tried putting that command in different files (such as all the ones mentioned in the original thread) and other directories, but to no avail. I can't get the side buttons to work automatically. I have to manually enter that command everytime I login. Is there another directory or file that I'm not aware of that would work? Please help.

thx in advance.
 
Old 06-28-2004, 11:05 AM   #7
bluephile
Member
 
Registered: Oct 2003
Posts: 45

Original Poster
Rep: Reputation: 15
Wow it's been a long time since I wrote that original HOWTO! It's a good thing I enabled email notification for this thread, I guess.

NWS,

What distro are you using? If xmodmap definitely works in /etc/X11/xinit/xinitrc.d/, then imwheel should too. Is the script set executable?
Code:
chmod a+x  /etc/X11/xinit/xinitrc.d/imwheel
If it already is, check to see if it's running but just not working
Code:
ps awux | grep imwheel | grep -v grep
If it doesn't seem to be running, try putting the imwheel command in ~/.xinitrc or /etc/X11/xinit/xinitrc. I use gentoo currently, and I use the latter file. After the usermodmap block, I have something that looks like:
Code:
if [ -x "`which imwheel`" ]; then
    imwheel -b 000089 -f
fi
(The odd -b argument is because I currently have XF86Config set up with 9 buttons instead of 7)

Let me know if any of this works, as well as your distro.

Cheers,
bluephile
 
Old 07-18-2004, 06:22 PM   #8
phyrko
Member
 
Registered: Jul 2004
Location: Glasgow, UK
Distribution: Ubuntu 6.10, FC5
Posts: 40

Rep: Reputation: 15
I am using Fedora 2 and an IntelliMouse Optical. I have followed your instructions to the letter but cannot get imwheel to send key presses. Do you have any idea where I might be going wrong? I have correctly edited my X config file, added an xmodmap script which works and successfully installed imwheel. I have tried both combinations of Up,Down/Left,Right (although I could not get imwheel -config to work properly) both in ~/.imwheelrc and the global imwheelrc file. It still does not work. What can I do?

Thanks,
phyrko
 
Old 07-19-2004, 09:33 AM   #9
lotheac
Member
 
Registered: Apr 2004
Location: Finland
Posts: 32

Rep: Reputation: 15
I have a slightly different configuration. First of all, .imwheelrc:
Code:
"(null)"
None, Up, Alt_L|Left
None, Down, Alt_L|Right
(null) is, for some reason, the window name for Firefox, which is the application I only need to use back/forward in. Next, XF86Config-4 InputDevice section:
Code:
Section "InputDevice"
        Identifier      "Configured Mouse"
        Driver          "mouse"
        Option          "CorePointer"
        Option          "Device"                "/dev/input/mice"
        Option          "Protocol"              "ExplorerPS/2"
        Option          "Buttons"               "7"
        Option          "ZAxisMapping"          "4 5"
EndSection
You may notice the different ZAxisMapping and Protocol here. This is because I'm using a MS IntelliMouse Explorer 4.0, which seems to need different configuration than the earlier versions of the same mouse. "Tilt Wheel" doesn't work, which I don't mind, but I just thought I'd point it out. xev doesn't read side-scrolling with the "tilt wheel" at all.

edit: Also, I don't need to use xmodmap since it would only be -e "1 2 3 4 5 6 7".

Last edited by lotheac; 07-19-2004 at 09:35 AM.
 
Old 07-19-2004, 08:11 PM   #10
Earth
LQ Newbie
 
Registered: Jul 2004
Location: Boston, MA USA
Distribution: Slackware 10
Posts: 24

Rep: Reputation: 15
Argh, I can't believe I didn't stick to this thread first to figure out what the problem was.

My eureaka moment here was that my intellimouse's thumb1 thumb2 are equivalent with the setup here to mousewheel left and right.

Thank you bluephile.
 
Old 07-21-2004, 11:16 PM   #11
bluephile
Member
 
Registered: Oct 2003
Posts: 45

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by phyrko
It still does not work. What can I do?
Perhaps the problem is in your imwheel config file. Have you tried messing with the window title setting? ".*" should match anything, but lotheac mentioned that he had to set it to "(null)" for it to work. Does that change anything? What happened when you tried to run imwheel --config?

Quote:
Originally posted by Earth
Thank you bluephile.
My pleasure. :-)
 
Old 07-29-2004, 09:57 AM   #12
pibby
Member
 
Registered: Oct 2003
Location: Houston, TX
Distribution: Debian Sid
Posts: 100

Rep: Reputation: 15
Just wanted to extend my thanks for this! It's so good to have the side buttons working!
 
Old 08-02-2004, 06:12 AM   #13
GlaDiaC
LQ Newbie
 
Registered: Jan 2004
Location: Kempten
Distribution: SuSE
Posts: 19

Rep: Reputation: 0
Xmodmap

simply do as user

Code:
echo "pointer = 1 2 3 6 7 4 5" > ~/.Xmodmap
 
Old 08-03-2004, 06:38 AM   #14
F_for_Fragging
LQ Newbie
 
Registered: Aug 2004
Distribution: SuSe Linux 9.1 Personal
Posts: 1

Rep: Reputation: 0
Thanks for the useful HOWTO. Bluephile, do you give permission to post it on other websites? Unfortunately I had to up this topic because you don't want to be e-mailed.

Last edited by F_for_Fragging; 08-03-2004 at 06:40 AM.
 
Old 08-07-2004, 07:37 PM   #15
bluephile
Member
 
Registered: Oct 2003
Posts: 45

Original Poster
Rep: Reputation: 15
Not sure what you mean, F_for_Fragging. My profile settings or something? Feel free to contact me:

bluephile {(a)} gmail {period} com
or
bluephile {(a)} bluephile {period} dyndns {period} org

Post this wherever you want, I release it into the public domain :-)

[EDIT]
Ah, found what you mean. I joined this board a very long time ago and haven't used it much since except for this topic. I changed the setting.
[/EDIT]

Last edited by bluephile; 08-07-2004 at 07:40 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mouse side buttons (mixed up mapping) hometoast Linux - Hardware 2 10-05-2005 03:21 PM
intelli mouse side buttons Xios SUSE / openSUSE 1 02-12-2005 10:38 AM
disabling side buttons on wireless mouse bradleyw Linux - Hardware 3 02-02-2005 02:27 AM
side mouse buttons - forward and back? Moebius Linux - Software 3 08-07-2004 11:14 AM
side mouse buttons on intellimouse Slack10 Earth Slackware 7 07-18-2004 11:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 02:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration