# X/Mouse Extra Buttons HOWTO

## meowsqueak

EDIT: This post formed the basis for the following Gentoo Wiki article: http://gentoo-wiki.com/HOWTO_Advanced_Mouse

Got one of those Microsoft Explorer/Intellimouse mice with the extra buttons? Ever wondered how to get those buttons working in X? Wonder no more...

(This has been tested with a Microsoft Intellimouse Optical and should work with the Explorer too. I would like people to try this out for themselves please and report back on what other mice work or don't work with this method).

A typical configuration for such mice often looks like this [XF86Config]:

```
Section "InputDevice"

    Identifier  "Mouse1"

    Driver      "mouse"

    Option      "Protocol"     "ImPS/2"

    Option      "Device"       "/dev/mouse"

    Option      "ZAxisMapping" "4 5"

EndSection
```

This typically gives you the usual three-button X mouse and a scroll wheel. On my Intellimouse Optical I have two extra buttons, one on each side. I call these 'side buttons' in this HOWTO. With the above configuration, they do nothing, and don't even generate X events.

If you haven't met it already, let me introduce you to a program called 'xev'. Fire it up, move the mouse over the window that pops up, and try hitting a few keys, clicking buttons, etc. If you click the side buttons and nothing happens, read on.

First, you need to change your XF86Config file to use a newer protocol called ExplorerPS/2. I need some input here from people with USB mice - what can you use for USB? You also need to tell the mouse driver that there are now seven buttons in total (left, middle, right, wheelup, wheeldown, side-left, side-right) and this is important too - map the ZAxisMapping to buttons six and seven, NOT four and five:

```
Section "InputDevice"

    Identifier  "Mouse1"

    Driver      "mouse"

    Option      "Protocol"     "ExplorerPS/2"

    Option      "Device"       "/dev/mouse"

    Option      "Buttons"      "7"

    Option      "ZAxisMapping" "6 7"

EndSection
```

Ok, now restart your X server and you should be able to get something happening with xev and those side buttons. You'll probably also notice that the side buttons perform the same functions that the mouse wheel used to.  This is because of the new ZAxisMapping.

[side note - you might think you could leave ZAxisMapping set to "4 5" but for some reason this doesn't work]

Now we need to fix the button mapping. The best way to do this is to invoke this command when X starts somewhere (e.g. in your .xinitrc):

```
xmodmap -e "pointer = 1 2 3 6 7 4 5"
```

Note the order of the numbers - we've swapped 6 and 7 with 4 and 5. After you run this, you'll find your mouse wheel works properly again. Now, returning to xev, you'll see that the side buttons now produce events. So we've got somewhere. Good.

Now emerge a useful little program called 'imwheel'. Create a file called ~/.imwheelrc and put this into it:

```
".*"

 None, Up,   Alt_L|Left

 None, Down, Alt_L|Right
```

If you read the man page for imwheel, you'll see that ".*" matches any window (although for me it doesn't seem to match the root window, don't know why - anyone know?) and the next two lines instruct imwheel on what to do when the buttons are pressed. Button 6 is 'down' and button 7 is 'up' - this doesn't relate to the action of pressing and releasing a button, it is actually because X maps these buttons onto a sort of virtual mousewheel or 'joystick'.

You can replace Alt_L|Left etc with whatever you want. These settings invoke forward/backward browsing in mozilla.

Now, the final step is to fire up the imwheel program:

```
$ imwheel -k -b "67"
```

Or run it straight after your xmodmap command wherever that may be...

You can do some pretty fancy stuff with this. I have a slightly enhanced .imwheelrc:

```
"mozilla*"

 None, Up,   Alt_L|Left

 None, Down, Alt_L|Right

"XTerm"

 None, Up,   Alt_L|Control_L|S

 None, Down, Alt_L|Control_L|T

# this should be last

".*"

 None, Up,   Alt_L|Control_L|P

 None, Down, Alt_L|Control_L|O
```

Just remember to put the ".*" entry LAST since imwheel stops looking once it matches an entry.

Those longish Alt_L|Control_L|... sequences match settings in my fluxbox/keys file, which do various things such as open new xterms, ffwd xmms, or open the selected URL in Mozilla. 

If you've read this far, hopefully everything has worked and you now have all the buttons on your mouse working. Please contribute to this thread if you have further details, or wish to point out errors or inconsistencies.

And as an added bonus, here's a nice little script you can bind to one of your mouse buttons with your window manager. It opens the currently selected text (usually a URL) in a new mozilla tab:

```
#!/bin/bash

# opens a new tab at selected URL

if mozilla -remote 'ping()' \;

then

        mozilla -remote "openURL(`xclip -o`, new-tab)"

else

        mozilla `xclip -o`

fi
```

Happy mousing!

--

meowsqueakLast edited by meowsqueak on Mon Jul 03, 2006 10:58 pm; edited 1 time in total

----------

## tomchuk

You also might have to add

```

"(null)"

None, Up, Alt_L|Left

None, Down, Alt_L|Right

```

to you ~/.imwheelrc to make this work with some wm's and some apps - Gnome/Metacity being the biggie.

And you'll either have to chmod +s /usr/bin/imwheel or use the -p option when starting it or it'll complain about the pid file.

For some troubleshooting use imwheel -D which will report a whole bunch of stuff that you can use to nail down a problem:

```

thomas@dualie $ imwheel -D

 

PidFile=/tmp/imwheel.pid

INFO: imwheel started (pid=10363)

display=:0.0

getRC:filename="/home/thomas/.imwheelrc"

uid=1000 euid=0

gid=100 egid=0

/home/thomas/.imwheelrc: No such file or directory

/home/thomas/.imwheelrc: file permissions for your REAL user do not allow you to read it!

getRC:filename="/etc/X11/imwheelrc"

uid=1000 euid=0

gid=100 egid=0

/etc/X11/imwheelrc: stats.st_uid=0 stats.st_gid=0 stats.st_mode=1ed

getRC:pre:line:

"(null)"

getRC:win:line:""(null)""

id="(null)"

getRC:pre:line:

None, Up, Alt_L|Left

getRC:mod:line:"None,Up,Alt_L|Left"

Priority: 0

Keysym mask: "None"

0) "None" "(null)"

Button: "Up"

        =4

Keysyms Out: "Alt_L|Left"

0) "Alt_L" "Left"

1) "Left" "(null)"

getRC:pre:line:

None, Down, Alt_L|Right

getRC:mod:line:"None,Down,Alt_L|Right"

Priority: 0

Keysym mask: "None"

0) "None" "(null)"

Button: "Down"

        =5

Keysyms Out: "Alt_L|Right"

0) "Alt_L" "Right"

1) "Right" "(null)"

getRC:pre:line:

 

getRC:pre:line:

".*"

getRC:win:line:"".*""

id=".*"

getRC:pre:line:

None, Up, Alt_L|Left

getRC:mod:line:"None,Up,Alt_L|Left"

Priority: 0

Keysym mask: "None"

0) "None" "(null)"

Button: "Up"

        =4

Keysyms Out: "Alt_L|Left"

0) "Alt_L" "Left"

1) "Left" "(null)"

getRC:pre:line:

None, Down, Alt_L|Right

getRC:mod:line:"None,Down,Alt_L|Right"

Priority: 0

Keysym mask: "None"

0) "None" "(null)"

Button: "Down"

        =5

Keysyms Out: "Alt_L|Right"

0) "Alt_L" "Right"

1) "Right" "(null)"

WinAction (0x8056f50):

        Priority         : 0

        Window Regex     : "(null)"

        Keysyms Mask (0x8056e38):

                "None"

        Button           : 4

        Keysyms Out (0x8056e58) :

                "Alt_L"

                "Left"

        Reps: 1

        Rep Delay: 0

        Key Up Delay: 0

WinAction (0x8056f70):

        Priority         : 0

        Window Regex     : "(null)"

        Keysyms Mask (0x8056f00):

                "None"

        Button           : 5

        Keysyms Out (0x8056f20) :

                "Alt_L"

                "Right"

        Reps: 1

        Rep Delay: 0

        Key Up Delay: 0

WinAction (0x8056f90):

        Priority         : 0

        Window Regex     : ".*"

        Keysyms Mask (0x8056e98):

                "None"

        Button           : 4

        Keysyms Out (0x8056eb8) :

                "Alt_L"

                "Left"

        Reps: 1

        Rep Delay: 0

        Key Up Delay: 0

WinAction (0x8056fb0):

        Priority         : 0

        Window Regex     : ".*"

        Keysyms Mask (0x8057008):

                "None"

        Button           : 5

        Keysyms Out (0x8057028) :

                "Alt_L"

                "Right"

        Reps: 1

        Rep Delay: 0

        Key Up Delay: 0

Grab buttons!

Grabbing Button 4...

Grabbing Button 5...

Grabbing Button 6...

Grabbing Button 7...

Grabbing Button 8...

Grabbing Button 9...

starting loop...

```

xmodmap -pp can also help to make sure that your buttons are being mapped correctly:

```

root@dualie # xmodmap -pp

There are 7 pointer buttons defined.

 

    Physical        Button

     Button          Code

        1              1

        2              2

        3              3

        4              6

        5              7

        6              4

        7              5

```

----------

## ecatmur

Good stuff. I've decided to map the side buttons to buttons 8 and 9 - I only have one scroll wheel but this way I can tell imwheel to detect them as 'Thumb1' and 'Thumb2'. (Plus it leaves buttons 6 and 7 open for when I do get a horizontal scrollwheel...)

So, I use 

```
    Option "Buttons" "9"

    Option "ZAxisMapping" "6 7 8 9"
```

 in XF86Config, and use an xmodmap of 

```
pointer = 1 2 3 8 9 4 5 6 7
```

Note that you can dump that line in /etc/X11/Xmodmap and symlink to that from /etc/X11/xinit/.Xmodmap, and the X startup scripts will execute it automatically (a Gentoo feature, I think).

Also, I use 

```
# Start imwheel

if [ -x "`which imwheel`" ]; then

    imwheel -b 000089 -f

fi
```

 to start imwheel - I've put it in /etc/X11/xinit/xinitrc and in /etc/X11/gdm/gnomerc. "-b 000089" means to grab only buttons 8 and 9, and -f seems to work best with the Metacity window manager.

Finally, here's some of my imwheelrc:

```
"^XMMS_Player$"

None,           Thumb1, Left    # 5 sec back

None,           Thumb2, Right   # 5 sec fwd

 

"^XMMS_Playlist$"

None,           Thumb1, Z       # Previous song

None,           Thumb2, B       # Next song

 

"^XMMS_Equalizer$"

None,           Thumb1, Left    # Balance left

None,           Thumb2, Right   # Balance right

 

"^Gvim$"

#None,          Thumb1, Control_L|Shift_L|W, 2  # Previous window - doesn't work

None,           Thumb1, Control_L|W|K   # Window above

None,           Thumb2, Control_L|W, 2  # Next window

 

"^Epiphany-bin$"

None,           Thumb1, Alt_L|Left              # Go back

None,           Thumb2, Alt_L|Right             # Go forward

Shift_L,        Thumb1, Control_L|Page_Up       # Previous tab

Shift_L,        Thumb2, Control_L|Page_Down     # Next tab

"^GV$"

None,           Thumb1, Page_Up                 # Previous page

None,           Thumb2, Page_Down               # Next page

".*"

@Priority=-1000

@Exclude

@Repeat

 

"\(null\)"

@Priority=-1000

@Exclude

@Repeat
```

The last two blocks prevent the imwheel defaults being used on unmatched windows, just in case there are any apps out there that know what to do with buttons 8 and 9...   :Wink:  Oh, and - before I forget  :Embarassed:  - thanks!   :Very Happy: Last edited by ecatmur on Wed Oct 22, 2003 12:32 pm; edited 1 time in total

----------

## nico--

Would this method also work for mice with even more buttons? Like those new ones that have 'web' buttons on them.

----------

## ecatmur

Maybe someone will correct me, but I can't see any way to use more than 9 buttons in total with imwheel and xmodmap. Might be time for someone to make a patch - I probably would if I had such a mouse. 

By the way, how do they fit more than 9 logical buttons onto a mouse anyway? What does the Windows software do with the actions? Can you link to a product page?

----------

## meowsqueak

No problem.

Do you know how to match the root window btw? I'd love to have my buttons work on the root window - but imwheel doesn't match it with ".*" - is there a special ID for it?

----------

## ecatmur

Sorry, I don't - xprop -root doesn't give a window name or class. The imwheel manpage mentions the Window Resource Name - I've forgotten what that is for the root window though. Alternatively you could match on "\(null\)" I guess, and hope it doesn't match any other windows.

----------

## meowsqueak

Unfortunately, it seems neither "(null)" or "\(null\)" match the root window. When I used imwheel -D, it seems that the last window that had focus is checked when clicking on the root window - I wonder if that's because the root window is never actually selected in fluxbox.

----------

## ecatmur

Eh, that sucks. (You could always I guess use a desktop program without anything on it...)

----------

## marienZ

Thanks, now I just have to figure out what to do with the extra button...

I'm using a logitech mx300, which has just one extra button, and your howto works just fine. I think it's a bit odd I have to use the ExplorerPS/2 driver for this mouse, but what the heck, it works  :Wink:  (apparently, logitech and microsoft are using the same protocol here, or the linux usb hid driver is, i'm not sure).

----------

## nico--

 *ecatmur wrote:*   

> Maybe someone will correct me, but I can't see any way to use more than 9 buttons in total with imwheel and xmodmap. Might be time for someone to make a patch - I probably would if I had such a mouse. 
> 
> By the way, how do they fit more than 9 logical buttons onto a mouse anyway? What does the Windows software do with the actions? Can you link to a product page?

 

Here is one mouse with more than 9... two buttons + the wheel (3) + the two thumb buttons + the three buttons near the wheel.

----------

## greenbob

I have followed all the instructions I can find but am still unable to get my side buttons to work.

The wheel works fine in mozilla but the side buttons only scroll up in mozilla

I use startx to start gnome, and placed these lines in /etc/X11/Sessions/Gnome:

```
xmodmap -e "pointer = 1 2 3 6 7 4 5"

imwheel -k -b 67
```

my .imwheelrc looks like this:

```
"mozilla*"

 None, Up,   Alt_L|Left

 None, Down, Alt_L|Right

"XTerm"

 None, Up,   Alt_L|Control_L|S

 None, Down, Alt_L|Control_L|T

# this should be last

".*"

 None, Up,   Alt_L|Control_L|P

 None, Down, Alt_L|Control_L|O

```

and my XF86Config looks like this:

```
Identifier   "Mouse1"

    Driver   "mouse"

    Option "Protocol"     "ExplorerPS/2"

    Option "Device"       "/dev/input/mice"

    Option "Buttons"      "7"

    Option "ZAxisMapping" "6 7"
```

----------

## tomchuk

The window title in quotes in the imwheelrc file is evaluated as a RegEx. So when you say "mozilla", what imwheel is doing is matching to window titles that are "mozilla" and "mozilla" only. If you want to match a window title that has mozilla in it, use "^<window name>$" as in ecatmur's example. So for mozilla it would be "^mozilla-bin$" as /usr/bin/mozilla is just a script to run /usr/lib/mozilla/mozilla-bin. Use ps to check for what is actually running. ie. xterm is not "Xterm", but "xterm". So to match all xterm windows you'd use "^xterm$"

Also, when specifying buttons with the -b option with imwheel, the should be in quotes, like "67" instead of just 67

Make those 2 changes and everything should be working for you.

----------

## greenbob

I followed the instructions exactly and now have the mouse working correctly, however, I was wondering, is there any way to speed up the scrolling speed of the mouse?

----------

## tomchuk

I believe scrolling behavior is managed by the window manager. For instance in KDE (kwin) you can change the options in control center -> peripherals -> mouse -> advanced -> "mouse wheel scrolls by".

But there is nothing stopping you from using imwheel to map buttons 4 and 5 (your wheel) to PgUp and PgDn if you want a little more scroll.

----------

## RedBeard0531

Why arnt apps writen to natively take advantage of these buttons, as opposed to such (IMO) dirty hacks. I realize that UNIX traditionaly supported 3 buttons, but come on! They were able to allow for the wheel after all. These are not a passing tchnology "fad". I think that linux devs need to get with the times, instead of sticking to old standerds.

----------

## meowsqueak

Mouse handling in X has nothing to do with 'UNIX'.

X has the concept of 'events' (as does Windows) and a control heirarchy - peripherals such as your mouse and keyboard generate events that are passed down the heirarchy in different ways. First, the input stimulus received by the kernel (via a driver) and is passed to user-space and converted to an X event by an X input driver. Then this event is passed up to an application. This application may be a window manager, an app like something like Mozilla, or it may be something in a slightly different role, like imwheel.

When you consider that these extra buttons do NOT work in Windows by default (you need a special driver installed, which recently is there by default I think, but it wasn't always - I'm thinking of that scroll feature) then it's not so bad to have a separate program manage these events. It provides far more flexibility, as well as reducing the amount of work a particular developer has to go through to make his app work with every possible button event. Consider that button X on one mouse might make sense as a 'Browser Forward' instruction but on another it might generate the mousewheel-down event.

I agree it could be better - most of the really nifty and powerful things you can do in *nix are the result of similar 'ugly hacks'. You can't even begin to do the same sort of stuff in Windows without writing your own mouse hook handler - and that is ugly! But I know what you're saying - emulating keyboard presses isn't exactly elegant.

But if it works... then what's the problem?

----------

## ck42

Still trying to figure out how to make my side (thumb) button do something like minimize a window (my fav. for the thumb button in windoze).

Is this even possible?  Can you specify actions like this?

----------

## meowsqueak

imwheel only sends keyboard 'events', but if you configure 'minimise window' to some key combo in your window manager, then yes, it's possible.

In time, you'll come to realise that anything is possible in Linux, however the required time and effort to implement certain things is unbounded... Unless you want to reverse engineer certain other operating systems, you can argue that certain things are impossible with those.

----------

## tommythecat

Hey thanks for the guide.  But I have a very newbish question

First:

Im a complete and total linux newb just trying to get my feet wet.

Second:

I am running redhat 9

I was pointed to this link by a friend because I am trying to get all of my mouse buttons to work.  

I went through your instuctions and everything seems to be working fine up to getting the line: xmodmap -e "pointer = 1 2 3 6 7 4 5" to run automatically at start up.

Everything works great if I run that line from a terminal each time I boot, but I can't seem to get it to run automatically, so I figured that before i mess things up fumbling around with things I know nothing about I should probably come here and ask the experts.  Can anyone here give me specific (remember im a complete newb to linux) instructions on how to get that line to run automatically each time I satrt X-windows?

Any help will be greatly apreciated.

Thank you.

----------

## ecatmur

Sorry, but the correct way to get xmodmap to swap the buttons will likely differ between distros. You would be better off asking that question in a Red Hat support forum or a general Linux forum.

----------

## sarumont

I have an Intellimouse Trackball Explorer (7 buttons).  The wheel is working and the two extra buttons are working, but for some reason Mozilla Firebird doesn't go back and forward with my settings:

```
"konsole"

None, Up, Shift_L|Left

None, Down, Shift_L|Right

".*"

None, Up, Alt_L|Left

None, Down, Alt_L|Right

```

And under the "Go" menu it says that Alt+Left/Right will produce Back/Forward...and using the actual physical keys will do that.  Anyone know why this isn't working with the buttons on my trackball?

----------

## greenbob

Is there a way to get the scroll wheel to scroll withing boxes or frames on a webpage, (similar to in windows) rather than always scrolling the entire page?

----------

## genoob

To get the side buttons working in xfce4, you need to make a little script (and set it as executable) in your ~/Desktop/Autostart/ directory:

```

#!/bin/sh

xmodmap -e "pointer = 1 2 3 6 7 4 5" & 

imwheel -k -b "67" -p

```

The rest of the settings for the imwheelrc and XFConfig files are the same as explained already.

----------

## DeepThoughts

Hi!

Im very new to Linux (1½ week) and I can't get this to work... I can do it manualy but I can't get it to work automaticly.

My problems are that I don't seem to have an .xinitrc file and I don't know how to execute 'xmodmap -e "pointer = 1 2 3 6 7 4 5"' trough .xinitrc or any other file...

Hope this makes sense...

I'm running kernel 2.4.20-r8 and Gnome 2.4

//Stefan

----------

## greenbob

I would suggest placing those lines in the file /etc/X11/xinit/xinitrc

You could make your own file .xinitrc and place it in your home directory but for a newb I would not recommend this. And you do not need an execute command, just put that line in the file, do this towards middle of file, usually right after it loads xmodmap. And be sure to place the xmodmap line before the imwheel line.

----------

## DeepThoughts

I still can't get it to work...  :Crying or Very sad:  Could someone take a look at my /etc/X11/xinit/xinitrc and tell where to put it and how to put it?

```
#!/bin/sh

# $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $

userresources=$HOME/.Xresources

usermodmap=$HOME/.Xmodmap

xinitdir=/usr/X11R6/lib/X11/xinit

sysresources=$xinitdir/.Xresources

sysmodmap=$xinitdir/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then

    xrdb -merge $sysresources

fi

if [ -f $sysmodmap ]; then

    xmodmap $sysmodmap

fi

if [ -f $userresources ]; then

    xrdb -merge $userresources

fi

if [ -f $usermodmap ]; then

    xmodmap $usermodmap

fi

# First try ~/.xinitrc

if [ -f "$HOME/.xinitrc" ]; then

   XINITRC="$HOME/.xinitrc"

   exec /bin/sh "$HOME/.xinitrc"

# If not present, try the system default

elif [ -n "`/etc/X11/chooser.sh`" ]; then

   exec "`/etc/X11/chooser.sh`"

# Failsafe

else

   # start some nice programs

   twm &

   xclock -geometry 50x50-1+1 &

   xterm -geometry 80x50+494+51 &

   xterm -geometry 80x20+494-0 &

   exec xterm -geometry 80x66+0+0 -name login

fi

```

----------

## greenbob

It's working b/c its not in there at all. Try this instead using the 9 button method posted by ecatmur, which works even if you don't have 9 buttons, and is the one I'm currently using. Then you must make a file called .imwheelrc and place this in your home directory, just copy the one listed in the 9 button method, you may want to add some lines for mozilla, if that is what you use.

```
#!/bin/sh

# $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $

userresources=$HOME/.Xresources

usermodmap=$HOME/.Xmodmap

xinitdir=/usr/X11R6/lib/X11/xinit

sysresources=$xinitdir/.Xresources

sysmodmap=$xinitdir/.Xmodmap

xmodmap -e "pointer = 1 2 3 8 9 6 7"

imwheel -b -p 000089 -f

# merge in defaults and keymaps

if [ -f $sysresources ]; then

    xrdb -merge $sysresources

fi

if [ -f $sysmodmap ]; then

    xmodmap $sysmodmap

fi

if [ -f $userresources ]; then

    xrdb -merge $userresources

fi

if [ -f $usermodmap ]; then

    xmodmap $usermodmap

fi

# First try ~/.xinitrc

if [ -f "$HOME/.xinitrc" ]; then

   XINITRC="$HOME/.xinitrc"

   exec /bin/sh "$HOME/.xinitrc"

# If not present, try the system default

elif [ -n "`/etc/X11/chooser.sh`" ]; then

   exec "`/etc/X11/chooser.sh`"

# Failsafe

else

   # start some nice programs

   twm &

   xclock -geometry 50x50-1+1 &

   xterm -geometry 80x50+494+51 &

   xterm -geometry 80x20+494-0 &

   exec xterm -geometry 80x66+0+0 -name login

fi
```

----------

## Hairshorts

I'm having trouble getting my side button to work with imwheel.  I have an intellimouse mouseman optical USB mouse which has a scroll wheel and one side button.  If I run xev before running imwheel I can generate ButtonPress events with the side button, and it shows up as button 6, so I think my XF86Config is set up correctly.  I then run 

```
imwheel -k -b "6"
```

 with the following .imwheelrc:

```
".*"

None, Up, F1

```

Now when I run xev the side button generates KeyPress events with keycode 99, which happens to be the same keycode as the Page Up key.  The strange thing is, when I hit the side button in some applications, such as emacs, it recognizes the keystroke as F1, but when I hit the side button in gkrellm it recognizes it as Page Up and changes my theme, instead of popping up the configuration window as it should.   I've tried more bindings than just F1, and they all exhibit the same behavior.  How on earth can I give button 6 a different keycode?

----------

## stormer

Attention!

ehci-hcd is no enough driver support to get the wheel working whit sis usb controller.

You have to compile ohci-hcd too, with both every thing works find with IMPS/2 drivers.

It is true for both 2.4 and 2.6 kernel.

Have fun!

p.s. It is probably the same whit Via chips using uhci-hcd.

----------

## OliD

 *stormer wrote:*   

> Attention!
> 
> ehci-hcd is no enough driver support to get the wheel working whit sis usb controller.
> 
> You have to compile ohci-hcd too, with both every thing works find with IMPS/2 drivers.
> ...

 

This is definately so, because ehci is only for USB 2.0, ohci and uhci only for 1.*.

Ciao

Oli D.

----------

## jerome187

 *nico-- wrote:*   

>  *ecatmur wrote:*   Maybe someone will correct me, but I can't see any way to use more than 9 buttons in total with imwheel and xmodmap. Might be time for someone to make a patch - I probably would if I had such a mouse. 
> 
> By the way, how do they fit more than 9 logical buttons onto a mouse anyway? What does the Windows software do with the actions? Can you link to a product page? 
> 
> Here is one mouse with more than 9... two buttons + the wheel (3) + the two thumb buttons + the three buttons near the wheel.

 

I have this mouse, I got the 2 side buttons working (sortof, they produce events in xev) and the 2 buttons closest to the wheel (they just act like the wheel, nothing special about them for now)  but I cant get the one little button  below the wheel and wheel buttons to work.  any suggestions?  I threw in a button 8 in everything, but it dosent seem to work.

My xmodmap -pp

```
There are 8 pointer buttons defined.

    Physical        Button

     Button          Code

        1              1

        2              2

        3              3

        4              6

        5              7

        6              4

        7              5

        8              8

```

----------

## ecatmur

Ah... well, this could be interesting. 

I guess the first thing to do is to check whether the little button produces any X events at all, by clicking it over an xev window. You should do this with the ZAxisMapping turned off to see which button event it generates (I'm guessing 6, after the standard 5 for left-middle-right-back-forward).

If it does signal on button 6, you'll then need a ZAxisMapping of "7 8 9 10" (and Buttons "10") to prevent it overwriting that button, however that's where it gets interesting. As imwheel only currently supports 9 butons you'll need to either modify the source yourself or persuade the developer to modify it (hint: the quickest - if not the cheapest - way to get him to do this would be to buy him one of those mice to 'test with'). 

Once that's done it's plain sailing - use an xmodmap of "pointer = 1 2 3 8 9 10 4 5 6 7" and whatever the new button is now called in imwheelrc.

If X doesn't detect the little button, you'd have to look into modifying the mouse driver itself.   :Shocked:  - personally I view the X source tree as about twice as arcane and scary as the kernel tree...

----------

## jerome187

The two little buttons on either sides of the scroll wheel are just buttons 4 and 5, just like the scrool wheel is (I confirmed this in xev, and they act just like the scroll wheel also)  So I dont think I need to worry about those 2 little buttons at all, I think there just extra 4 and 5 butons, thats all (or at least thats what there acting like).

The other little button dosent generate anything in xev tho  :Sad:   Would really like to get it working so I can map it to Alt-Tab for easy window switching.

----------

## richjoyce

I have this mouse too (cordless mx 700) and although I haven't got them working yet (because I haven't had time, haven't tried) I can tell you this mouse has 8 different buttons.  The two buttons (1,2), the middle mouse button (3), the scroll up (4), scroll down (5) buttons above and below the wheel, and the wheel is also 4 & 5, and then the two side buttons (6,7) and then the windows changing button (function in windows) (8\)

I think the problem is, that jerome does not have the scroll wheel mapped as the last two buttons.  You have them as 6,7 and they should be 7,8, and then the physical 8 button should be 6

----------

## woodwizzle

I can't get my 2 other buttons to generate events. I added everything to my XF86COnfig and .xsession files. I looked at my log output and xmodmap gets an error saying bad number of buttons (5 instead of 7).

----------

## lucida

I'm using an Intellimouse Explorer 3 w/2 side buttons, and I have troubles with them. 

I set the XF86Config and xmodmap as described, and, I got two events when I press down one of the side buttons(button 6 and button2), and another 2 events when I released the button. Press another side button give me 7 and 3. 

Does anyone encounters the same problem?

----------

## xHemi

You guys should try to add a -p to your imwheel call. Like so:

```
imwheel -k -b "67" -p & 
```

Otherwise imwheel might die on you when it tries to write the PID file.

Hoped that helped someone   :Razz: 

----------

## Markus_T

 *Hairshorts wrote:*   

> I'm having trouble getting my side button to work with imwheel.  I have an intellimouse mouseman optical USB mouse which has a scroll wheel and one side button.  If I run xev before running imwheel I can generate ButtonPress events with the side button, and it shows up as button 6, so I think my XF86Config is set up correctly.  I then run 
> 
> ```
> imwheel -k -b "6"
> ```
> ...

 

The most important thing to remember is to use the -f option when starting

imwheel. This "forces the X event subwindow to be used" and should fix 

your problems. Otherwise some aplications (e.g. Firefox) don't behave as

they should.

Also try changing your .imwheelrc to:

```
".*"

None, Thumb1, F1

```

----------

## InfinityX

I've almost managed to get my MX500 working. It works fine if I type the xmod line into a terminal and start imwheel, but I just can't get it work when kde starts.

I placed the lines in the xinitrc (which I confess I haven't the slightest clue what's for). Care to help a dumbfounded newbie?  :Sad: 

----------

## tsigo

I've tried putting the xmodmap command in both ~/.xinitrc and ~/.xsession, neither makes a difference.  I've put it in my main user's folder and also /root.  Do I have to do something different if I use xdm (kdm) instead of startx?

----------

## theonlymcc

For anyone using a laptop with a touchpad and wanting to use a USB Intellimouse with the side buttons, this is for you. I triple checked all the files and options related to geting the side buttons working. No matter what I did, the side buttons would scroll and the wheel would do nothing. I fixed this by reversing two things in the XF86Config.

1.) Changed my touchpad from CorePointer to SendCoreEvents

2.) Change my usb mouse from SendCoreEvents to CorePointer.

Presto it worked. I am using a Dell i5150 if anyone is wondering.

P.S. - We (NC State, looking at my profile to the left, I live in Raleigh and go State) raped Duke tonight! YAY!!!!

----------

## mholtz

Yeah I noticed the same thing.  Apparently in X, if you want to use two pointers simultaneously, one has to be the CorePointer and the other can merely SendCoreEvents.  xmodmap can only modify the core pointer.  

In my case, I have a plain jane two button PS/2 mouse and a 7 button USB optical intellimouse.  I also had to move the Intellimouse to be the CorePointer in order to remap the buttons.

Is there no other way to remap buttons on non-CorePointer pointers?  What if I wanted one mouse to be right handed and the other left handed, for example?

----------

## metalh34d

Ok so I've tried to get my thumb buttons working. I first attempted the 9 button trick but that made it so my scroller didnt even work. I use a Logitec MX700 btw. Ok so basically what happens so far is any program I do if I use the button thumb button it does a middle click. If I do the top button it does a right click. Here's my xinit settings:

xmodmap -e "pointer = 1 2 3 6 7 4 5"

imwheel -k -b -p "67" -f

kahakai

my .imwheelrc looks like this atm:

"Firefox.*"

None, Up, Alt_L|Left

None, Down, Alt_L|Right

".*"

None, Up, Alt_L|Left

None, Down, Alt_L|Right

XF86Config:

Identifier  "Mouse1"

    Driver      "mouse"

    Option "Protocol"    "IMPS/2"

    Option "Device"      "/dev/input/mice"

        Option "Buttons"        "7"

        Option "ZAxisMapping"   "6 7"

Any input on the matter?

----------

## TenPin

I have a Logitech MX300 and I like to use the little button on top as my middle button and I never use the wheel as a button:

```

Section "InputDevice"

    Identifier  "Mouse0"

    Driver      "mouse"

    Option      "Protocol" "ExplorerPS/2"

    Option      "Device" "/dev/input/mouse0"

    Option      "Buttons" "6"

    Option      "ZAxisMapping" "5 6"

EndSection

```

Then:

```
xmodmap -e "pointer = 1 6 3 2 4 5"

```

If I use just IMPS/2 then the wheel button and the extra button both act as the middle button but I think using IMPS/2 has been the cause of my mouse going crazy every hour or so and giving a bytes lost error in dmesg.

----------

## allancairns

Hey guys,

Some great advice here. How about helping someone with an older device?

I'm running a Logitech Trackman Marble so old the model # has worn off the bottom (I got it in about 1998 I think). It is a trackball arrangement and has three buttons and NO SCROLLWHEEL.

When I use this mouse in Windows clicking the middle button results in a small icon popping up on my screen where the mouse pointer was that looks like four arrows pointing NSEW. Moving my pointer from this icon results in the active window scrolling in the direction I moved the pointer. This is great as it handles up-down AND left-right scrolling as well as scrolling at different speeds (depending on how far you move from the icon). You then click again on the middle button to get out of scroll mode.

Is there anything like this in Linux? I love this mouse (no problems with limited deskspace, great for gaming) but I find it a pain not having scroll in windows without a scrollbar (eg. transparent eterm) and even moving my mouse over to the scrollbar where it exists is annoying after my experience in Windows.

TIA,

----------

## helmers

I'd also like some help.

I've gotten a new, very nice mice, from Microsoft.   :Laughing: 

It's an Intellimouse Explorer 4, see it here:

http://www.microsoft.com/hardware/mouseandkeyboard/productdetails.aspx?pid=003#

The problem is that I would like to use all it's fancy features:

 - The tilt wheel, to scroll horizontally

 - The back and forward buttons

I've never had much luck with imwheel, could someone give me some easy steps to follow? The scrollwheel is on buttons "4 5" like regular mice.

Thanks!   :Wink: 

----------

## psofa

will someone make this sticky? it worked for me!  :Smile: 

----------

## helmers

It is in the tips and tricks section, I think there are many good threads here, and making one sticky and not all the others wouldn't be all nice.

What would be nice where if someone (with a lot of time and dedication) could go through these tips, and create a large document, divided into categories of tips.

I often find myself strolling these pages, but it is sometimes hard to find what one is looking for, even with the search function.

----------

## calhoun

bump

----------

## Garak128

I don't get it, none of the mentioned startup scripts work for me. I mean this worked fine, run xmodmap then imwheel and it loads up nicely. But putting the same commands in like /etc/xinit/xinitrc or any of the mentioned ones doesn't work.

I don't think there run at all.

The only place that worked was ~/.bashrc, but that runs it every time you open a console, which spams the imwheel text.

I'm just trying to get it to load on gnome at startup. Isn't there a simple place to put user startup scripts that gnome 2.4 will run no matter what?

----------

## Garak128

Got it to work on KDE.

I put it in the /home/user/.kde/Autostart dir.

Made a file that runs xmodmap and imwheel, with full paths and as root so it works for sure.

Still working on gnome, gota find a good spot to put it there.

----------

## pontifikas

God damn it, all of the sudden the side buttons ceased to work.

I have a Microsoft intelli mouse with 5 buttons.Everything was working smoothly (thanks to this Howto).Suddently it stoped.It happened soon after I updated to kde3.2.2.(I dont know if this is relevant though).

I dont know what happened.  :Crying or Very sad:  I cannot play ET without my side buttons  :Crying or Very sad: 

What is curious,is that sometimes it gets to work after I run fglrxconfig and fill the appropriate Options.But not always.

Has anyone any idea what might be happening.

I'm running kde and xmodmap together with imwheel comands are in the script "init_kde" located in /bin and also having a link into /home/user/.kde3.2/Autostart

Thanks

----------

## abiczo

Edit: My Opera tip actually didn't work. Opera seems to behave strangely with imwheel.

----------

## ereptor

ok, i imagine this is a newb question and i don't even know if this is the forum i should be posting it in but here goes...i don't know how to get my  mousewheel on my mouse to work, i have a logitech mouse, 2 button and a mousewheel

here is my input device setion in my XF86Config for my mouse

Section "InputDevice"

    Identifier  "Mouse1"

    Driver      "mouse"

    Option      "Protocol"    "PS/2"

    Option      "Device"     "/dev/psaux"

    Option      "ZAxisMapping" "4 5"

    Option      "Buttons"      "3"

EndSection

----------

## WaterSoul

 *ereptor wrote:*   

> 
> 
> Section "InputDevice"
> 
>     Identifier  "Mouse1"
> ...

 

You should try getting rid of the Option      "Buttons"      "3" Since your mouse have the normal aamount of buttons. The Buttons option override the defaults to get a bigger number for mouse with 7 or 10 mouse buttons.

----------

## ereptor

i have tried that but it didn't work either  :Sad: 

----------

## scourage

I'm using X.org's Xserver and had problems with the default imwheel command:

imwheel -k -b "67"

but I've found (in another thread by somebody else)  that by adding a couple more flags and it works fine:

imwheel -f -p -k -b "67" 

Cheers, 

Bob

----------

## Gibberx

I've just picked up this Compaq Wireless Desktop keyboard/mouse combo from Radio Shack yesterday. The mouse has two buttons on the sides, but according to xev, they generate the same events as buttons 2 and 3. Is there any way to change the events generated? I'm thinking a driver would be necessary to do something like that.

----------

## Nate_S

I think I've found a better way to set xmodmap to run when X starts.  If you notice in the file /etc/X11/xinit/xinitrc (which actually seems to be symlinked from /usr/X11R6/lib/X11/xinit/xinitrc,)  It already has provisions for doing just that.  It checks first if there is a file ~/.Xmodmap, and if so runs 'xmodmap ~/.Xmodmap.'  Then checks for and runs 'xmodmap /usr/X11R6/lib/X11/xinit/.Xmodmap' if the file exists.  So simply by creating a file called .Xmodmap with the line 'pointer = 1 2 3 6 7 4 5' (without the quotes, and modify to your needs,)  you can get it to run on a per user basis, (as I belive it was intended for keymaps,)  or, more usefully for a mouse, for any user.  

Hope this is what some of you were looking for,

Nate

----------

## gmalleus

I followed the directions and got my mouse working perfectly!  Then the next day when I booted up my side buttons stop producing events!  Anybody else experience this problem?  I put the xmodmap and imwheel commands in my fluxbox startup file so they would be run when I start my gui.   Wheel works fine after I boot up, but side buttons stopped prodcing events all together.  Can't understand why...  And I also noticed that Opera behaves strangely  with imwheel.  After mapping the buttons for it, and it working,  next time I started Opera, it had changed the buttons that control forward and backward from alt left and right to just z and x.  Strange...

Any Help Greatly Appreciated...

----------

## Nate_S

Are you sure that fluxbox startup file is getting executed on startup?  What happens if you try executing the commands again manually?  I can't comment on opera as I use firefox.

----------

## gmalleus

I'm positive that the file gets executed at startup, That the file where I set my background and other various little things, and they all execute.  Even if rerun the commands my I still see that no events are being produced by the side buttons in xev.

----------

## dthomson

 *Gibberx wrote:*   

> I've just picked up this Compaq Wireless Desktop keyboard/mouse combo from Radio Shack yesterday. The mouse has two buttons on the sides, but according to xev, they generate the same events as buttons 2 and 3. Is there any way to change the events generated? I'm thinking a driver would be necessary to do something like that.

 

I have the exact same problem with my intellimouse explorer

----------

## Nate_S

And you're both sure you're using the 'ExplorerPS/2' protocol?  that's needed for more than 3 buttons to produce seperate events.  here's the relevant section form my xorg.conf

```
# Identifier and driver

 

    Identifier  "Mouse1"

    Driver "mouse"

    Option "Protocol"   "ExplorerPS/2"

    Option "ZAxisMapping"   "6 7"

    Option "Buttons"      "7"

    Option "Device"     "/dev/input/mice"

 

```

also, what versions of X are you using?

-Nate

----------

## NathanW

I'm using suse 9.1. I have all the settings in the proper places yet something is still off.

all actions are coming up correctly with xev. side buttons now mapped as 6 7 scroll wheel functioning as it should. But Buttons 6 and 7 don't do page back or forward. They do how ever (if the page is wide enough) do page side to side. I'm stuck. Help. If anyone can it would be appreciated. Thanks Nathan

----------

## monotux

this is one of the better threads I've seen here - so thanks, all of you, for making the only thing I really miss from windows, work in linux!  :Smile: 

----------

## beastmaster

for MX500/700 gentoo men, here is the place for you

https://forums.gentoo.org/viewtopic.php?t=178733

 :Very Happy: 

----------

## monkman

sorry to freshen this up...... but:

i had my mouse (ms intellimouse optical) running fine under gentoo-2.6.3-r1 then turned to 2.6.6 and back to gentoo..

and now the extra buttons don't work any more.

i've checked:

/usr/X11R6/lib/X11/xinit/xinitrc

/home/USER/.xinitrc

/etc/X11/Sessions/kde-3.2.2

they all contain:

xmodmap -e "pointer = 1 2 3 6 7 4 5"

imwheel -k -b "67" -p &

but it only works when i start them manually.

how can i force it to start automatically when starting kde (typing startx) ??

thx!!!!

----------

## beastmaster

how about putting

xmodmap -e "pointer = 1 2 3 6 7 4 5"

imwheel -k -b "67" -p & 

in the .xinitrc file

----------

## monkman

i guess you mean the home/USER/.xinitrc file...  just what i did, but with no effect...

----------

## beastmaster

type xmodmap -pp 

and see if you got the button mapping sequence as 1 2 3 6 7 4 5,

if not, I think those two lines are not automatically loaded in .xinitrc, you can try putting it in your kde startup script, 

(as I dont use kde, so I'm not sure...), but you can put it in the system wide kde startup in

/etc/X11/Sessions/kde-3.2.2 

or put it in /etc/X11/xinit/xinitrc

 :Razz: 

----------

## SweetLou

 *NathanW wrote:*   

> I'm using suse 9.1. I have all the settings in the proper places yet something is still off.
> 
> all actions are coming up correctly with xev. side buttons now mapped as 6 7 scroll wheel functioning as it should. But Buttons 6 and 7 don't do page back or forward. They do how ever (if the page is wide enough) do page side to side. I'm stuck. Help. If anyone can it would be appreciated. Thanks Nathan

 

I am also using SuSE 9.1 and am getting the same results as you. I've been reading this thread over and over trying to discover what I have missed. So far, no luck.

----------

## InfinityX

Been trying to get this work for ages now but nothing seems to be executed. imwheel is never running and xmodmap never changes. I've tried pretty much everything in this thread and the other thread (and I was sure putting the commands in the session file would work).

Is there any reason that commands in ~/.xinitrc or /etc/X11/xinit/xinitrc aren't being executed?  :Sad: 

----------

## beastmaster

 *InfinityX wrote:*   

> Been trying to get this work for ages now but nothing seems to be executed. imwheel is never running and xmodmap never changes. I've tried pretty much everything in this thread and the other thread (and I was sure putting the commands in the session file would work).
> 
> Is there any reason that commands in ~/.xinitrc or /etc/X11/xinit/xinitrc aren't being executed? 

 

yeah, I noticed those before, but you can always try putting it in your current windows manager's startup script, it will defintely get executed there.

----------

## firephoto

Try checking out:

/etc/X11/xinit/.Xmodmap

and put a line in it like this.

```
pointer = 1 2 3 6 7 4 5 
```

If the file doesn't exist, make one.

For the imwheel part, or your xmodmap if you don't want to do the above part.

~/.kde/Autostart/imwheel.desktop

```
[Desktop Entry]

Comment=

Comment[en_US]=

Encoding=UTF-8

Exec=imwheel -k -b "67" -p &

GenericName=

GenericName[en_US]=

Icon=exec

MimeType=

Name=

Name[en_US]=

Path=

StartupNotify=false

Terminal=false

TerminalOptions=

Type=Application

X-DCOP-ServiceType=nonexbindkeys

X-KDE-SubstituteUID=false

X-KDE-Username=

```

~/.kde/Autostart/xmodmap.desktop

```
[Desktop Entry]

Comment=

Comment[en_US]=

Encoding=UTF-8

Exec=xmodmap -e "pointer = 1 2 3 6 7 4 5"

GenericName=

GenericName[en_US]=

Icon=exec

MimeType=

Name=

Name[en_US]=

Path=

StartupNotify=false

Terminal=false

TerminalOptions=

Type=Application

X-DCOP-ServiceType=none

X-KDE-SubstituteUID=false

X-KDE-Username=

```

----------

## gen2fox

 *ereptor wrote:*   

> ok, i imagine this is a newb question and i don't even know if this is the forum i should be posting it in but here goes...i don't know how to get my  mousewheel on my mouse to work, i have a logitech mouse, 2 button and a mousewheel
> 
> here is my input device setion in my XF86Config for my mouse
> 
> Section "InputDevice"
> ...

 

Remove: Option      "Buttons"      "3"

Change the protocol to: Option "Protocol"    "IMPS/2"

----------

## gen2fox

 *Gibberx wrote:*   

> I've just picked up this Compaq Wireless Desktop keyboard/mouse combo from Radio Shack yesterday. The mouse has two buttons on the sides, but according to xev, they generate the same events as buttons 2 and 3. Is there any way to change the events generated? I'm thinking a driver would be necessary to do something like that.

 

My mouse side buttons used to generate events for buttons 2 and 3 too, I followed the instructions and they work fine now.

----------

## demitrix

i followed the instructions too and they still generate events 2 and 3 D:

----------

## mlavalle

I have a USB scroll mouse by Logitech, and the scroll option doesn't work (it was working with Fedora and Windows).  I have the following in /etc/X11/XF86Config-4:

    Identifier  "Mouse1"

    Driver "mouse"

    Option "Protocol"       "IMPS/2"

    Option "ZAxisMapping"   "4 5"

    Option "Device"         "/dev/mouse"

    Option "Buttons"        "5"

/dev/mouse is a symlink to /dev/psaux.  I am using Kernel 2.4.25-gentoo-r1, and XFree86 with WindowMaker (no Gnome at this time).  I've tried a few suggestions as posted in the alt.linux.gentoo newsgroup, but nothing has worked so far and this is really starting to frustrate me.    :Mad: 

Has anyone run into this before?  I'm thinking of maybe trying "imwheel", but as I understand it XFree86 is supposed to support this wheel natively, and I am worried not all of my applications will support imwheel (such as Neverwinter Nights and Doom 3, when it's released).

----------

## Jazz

Hmm, ok i got the butons to work but i want some extra functionality from my mouse !

For example i want the mouse scroll button to minimize all the windows, and the right thumb button to fire up konqueror,. 

How can i do this ? except this stupid glitch everything seems to be working just perfect !

Kudos.

Bye,

Jazz

----------

## Jazz

Umm no replies ! can any one help me with this ?

Or can anyone give example for passing a Ctrl+Alt+K combination ? that way i'll configure kde to start the konqueror..

BYe,

Jazz

----------

## firephoto

Well if you are using kde it's simple for keyboard shortucts.

Just right click on the kicker and go into the menu editor and find the app you want to have a shortucut too and at the bottom it says "Current shortucut key:" click the box and do your key combo, change any other apps you want to then click close, then save, it updates the system, and you're good to go.

For the mouse to do commands do the xbindkeys and xvkbd would be the easiest. Just do like it says in the MX700 post I made, lots of info there.

----------

## ajs

i'm just about to give up. i have an ms intellimouse optical mouse and have never been able to get any output from the two thumb buttons in xev. scrolling works fine though.

here is a snip from XF86Config

```
Section "InputDevice"

    Identifier  "Mouse1"

    Driver      "mouse"

    Option "Protocol"    "ExplorerPS/2"

    Option "Device"      "/dev/psaux"

    Option "Buttons" "7"

    Option "ZAxisMapping" "6 7"

EndSection
```

i then run 

```
xmodmap -e "pointer = 1 2 3 6 7 4 5"
```

manually from a console, but i still get no output from the buttons in xev.

i'm using kde-3.2.3 and vanilla kernel 2.6.7.

any help is most appreciated.

----------

## baitken

 *greenbob wrote:*   

> I have followed all the instructions I can find but am still unable to get my side buttons to work.
> 
> The wheel works fine in mozilla but the side buttons only scroll up in mozilla
> 
> 

 

I had that same proble so I tried using the 9 button setup mentioned earlier on this board and now it works.

----------

## frodoontop

@ajs: Try to switch back to kernel 2.6.6. The 2.6.7 kernel didn't respond to my sidebuttons in xev, where 2.6.6 did.

<edit> When pulling out the usbTOps2 convertor and plugging my mouse directly in usb, sidebuttons worked again in 2.6.7 kernel. I didn't even have to restart, thanks to hotplug and udev (I think). </edit>Last edited by frodoontop on Sun Jul 11, 2004 2:18 pm; edited 1 time in total

----------

## mlt

After spending a couple days on this (don't ya just love the ease-of-use of Linux?), I now have my Intellimouse Optical USB mouse thumb buttons automatically working in KDE and kernel 2.6.7. The hard part was to get KDE to automatically remap the buttons (see below).

Here's the mouse section from my /etc/X11/XF86Config:

```
Section "InputDevice"

    Identifier  "IntelliMouseOptical"

    Driver      "mouse"

    Option "Protocol"    "ExplorerPS/2"

    Option "Device"      "/dev/mouse"

    Option "ZAxisMapping"  "6 7"

EndSection
```

Some items of note:

1. I renamed the identifier from "Mouse1" to "IntellimouseOptical" just for my own sake. Of course this means that the other parts of XF86Config where "Mouse1" showed up also had to be renamed.

2. The program "xev" is extremely useful for seeing how changes in the config affect the buttons.

3. My mouse and mousewheel worked with the "Auto" protocol, but it was absolutely necessary to use the "ExplorerPS/2" protocol to get the 2 thumb buttons recognized.

4. Specifying Option "Buttons" "7" appears to be redundant.

Once I had this, I could run:

```
xmodmap -e "pointer = 1 2 3 6 7 4 5"

imwheel -pfb "67"
```

and everything was peachy (using the .imwheelrc specified earlier in this thread).

Unfortunately, I had a very difficult time getting the xmodmap and imwheel commands to start automatically. They did not work in /etc/X11/xinit/xinitrc, they did not work in ~/.xinitrc. They did not work in the /etc/X11/Sessions/kde-3.2.2 script. Not in a box, not with a fox, not in a house, not with a mouse.

Eventually I put them near the top of the script in

```
/usr/kde/3.2/share/config/kdm/Xsession
```

(i.e., $KDEDIR/share/config/kdm/Xsession)

Now, using the /etc/X11/imwheelrc, I have working thumb buttons for all users on my system   :Mr. Green: 

Hope this helps someone else trying to automatically start xmodmap in KDE.

----------

## djdread

 *marienZ wrote:*   

> Thanks, now I just have to figure out what to do with the extra button...
> 
> I'm using a logitech mx300, which has just one extra button, and your howto works just fine. I think it's a bit odd I have to use the ExplorerPS/2 driver for this mouse, but what the heck, it works  (apparently, logitech and microsoft are using the same protocol here, or the linux usb hid driver is, i'm not sure).

 

I also have the MX300 and would like to use the 5th button as a back button in Firefox. I followed the above exactly just if for some reason it worked, but it doesnt, it screws everything up. Would you or someone else mind posting your config so I can see what I'm missing.

Thanks.

----------

## SmokyMcPot

I'm using Gnome 2.6 and everything works fine when i manually start xmodmap and imwheel. I put it in:

/usr/X11/xinit/xinitrc

/home/smoky/.xinitrc

but it never starts automatically. How can I tell Gnome to start this everytime for every user?

Thx

----------

## gen2fox

My .xinitrc file is:

```
xmodmap -e "pointer = 1 2 3 6 7 4 5"

imwheel -k -b "67" -p

 

exec gnome-session
```

Using GNOME 2.4, it works fine.

----------

## SmokyMcPot

And it's placed in /home/USER ?

----------

## gen2fox

Yes, /home/$USER

----------

## SmokyMcPot

Well, I tried that but didn't work. Hope someone has another idea - couldn't be so difficult I think ...

----------

## RealNitro

 *SmokyMcPot wrote:*   

> Well, I tried that but didn't work. Hope someone has another idea - couldn't be so difficult I think ...

 

My problem was that 'xmodmap' is not a command on my system. So, the mousewheel and the thumb-buttons were not switched around. As a noob, I don't know how to get that command 'xmodmap' working, so I searched for a different solution in these forums, and I found one:

- Create a file /etc/X11/Xmodmap

- add this content:

```
pointer = 1 2 3 6 7 4 5
```

This seems to to the same thing as executing "xmodmap -e ..."

----------

## SmokyMcPot

thx. And what's about imwheel?

----------

## RealNitro

 *SmokyMcPot wrote:*   

> thx. And what's about imwheel?

 

I put the imwheel message in .xinitrc , but also in some other files. I'll check it out later today.

----------

## Kroni

I have another serious problem. If i add ~/.xinitrc file to my box 

X wont start anymore  :Sad:  im not @ home to post special errors but i remmeber it tells me "No Screens found" ... 

Anyone maybe knows a solution ?

----------

## M_A_D

well, thanks to this how-to my thumb buttons on my intellimouse explorer 3.0 are working fine...

but while going through the how-to i found out that i cannot use xev. i mean i start the program, the window appears, but when i click a button over the window or press a key with the xev-window activated it shows nothing...

anyone got an idea why?

oh, and another thing:

you know in windows when i middle-click on something in firefox (which is not a link) i can get this auto-scroll thing and scroll by just moving the mouse up a bit or down a bit...

can i get that in linux too (using kde-3.2.2) ?

----------

## mlt

 *Quote:*   

> but while going through the how-to i found out that i cannot use xev. i mean i start the program, the window appears, but when i click a button over the window or press a key with the xev-window activated it shows nothing... 

 

When you start xev, do you start it from a terminal or from the "Run command" menu? You must start it from a terminal, because it spits out all its output on the terminal.

----------

## M_A_D

 *mlt wrote:*   

>  *Quote:*   but while going through the how-to i found out that i cannot use xev. i mean i start the program, the window appears, but when i click a button over the window or press a key with the xev-window activated it shows nothing...  
> 
> When you start xev, do you start it from a terminal or from the "Run command" menu? You must start it from a terminal, because it spits out all its output on the terminal.

 

thanks...

foolish me did of course run it from the run-command...   :Embarassed: 

----------

## Joffer

 *genoob wrote:*   

> To get the side buttons working in xfce4, you need to make a little script (and set it as executable) in your ~/Desktop/Autostart/ directory:
> 
> ```
> 
> #!/bin/sh
> ...

 Why? Doesn't xfce4 support ~/.xinitrc? (Apparantly not, since I've got those line in my .xinitrc and it isn't invoced when I startxfce4.

Just a quick sidequstion - what should I put in XSESSION in rc.conf to start xfce4 as default?

----------

## Joffer

 *genoob wrote:*   

> To get the side buttons working in xfce4, you need to make a little script (and set it as executable) in your ~/Desktop/Autostart/ directory:
> 
> ```
> 
> #!/bin/sh
> ...

 

Or you could add this to your .xinitrc file (I've added it to bottom of the file)

```
source /etc/xfce4/xinitrc
```

----------

## thechris

these intructions fail for me.  here is the relevent output:

```
bash-2.05b$ xmodmap -e "pointer = 1 2 3 6 7 4 5"

xmodmap:  commandline:0:  bad number of buttons, must have 5 instead of 7

xmodmap:  1 error encountered, aborting.

bash-2.05b$ imwheel -k -b "67" -p 

WARNING: imwheel process could not be verified, it may not be running anymore, that's OK!

: No such file or directory

WARNING: imwheel process could not be verified, it may not be running anymore, that's OK!

: No such file or directory

WARNING: imwheel pid file could not be removed.

  Perhaps you want the -p option.

  Or SUID root the imwheel executable...

: Operation not permitted

WARNING: imwheel is not checking/writing a pid file, BE CAREFUL!

  An imwheel may be running already.

  Two or more imwheel processes on the same X display,

  or simultaneously using a wheel fifo,

  will not operate as expected!

INFO: imwheel started (pid=22910)

bash-2.05b$ ps -A | grep imwheel

22910 ?        00:00:00 imwheel

```

----------

## thechris

added option buttons 7  and zaxismapping from 4 5 to 6 7.

result -- mousewheel now moves back and forward...

so i switch zaxis back to 4 5.  mouse wheel works, side buttons don't...

----------

## RealNitro

 *thechris wrote:*   

> added option buttons 7  and zaxismapping from 4 5 to 6 7.
> 
> result -- mousewheel now moves back and forward...
> 
> so i switch zaxis back to 4 5.  mouse wheel works, side buttons don't...

 

You _have_ to use the xmodmap command in some way. If there is no such command, check my previous post here to do it in a different way (with an Xmodmap file).

----------

## thechris

how do i use xmodmap.  as i said in the last post, i changed the number of buttons in xfree.

restart xfree

xmodmap works.  now the side mouse buttons still don't work and the mousewheel moves forward or back in pages...

what new xmodmap command must i try.

----------

## firephoto

xmodmap -p

That will show you how the buttons are mapped currently. Just run that from a user console then adjust the mapping order till the buttons are mapped to their proper function.

So use something like

xmodmap -e "pointer = 1 2 3 6 7 4 5"

or 1:1

xmodmap -e "pointer = 1 2 3 4 5 6 7 "

You'll eventually find something that works.

The changes are instant when you are inside of X so you don't need to log off and back on each time you change it, only to test your startup config to make sure it works.

Also you should kill imwheel till you get your the basic buttons showing some output then setup imwheel if that's what you want to use.

What kind of mouse are you using?

----------

## thechris

i noticed the xmodmap would fix the error with the mousewheel up/down

one combo -- 1 2 3 6 7 4 5 took away my mousewheel and gave it fwd/back capabilites in browser

the other -- 1 2 3 4 5 6 7 gave me mousewheel, but did not give me fwd/back mouse buttons.

edit -- gentoo has broke and i can not log into X.  permission is suddenly denied.  i may take a while to get back to this thread.

----------

## Barks

Whenever I try to issue an imwheel command of some sort I recieve an error which always ends:

```

Xlib: connection to ":0.0" refused by server

Xlib: No protocol specified

Could not open display, check shell DISPLAY variable, and export or setenv it!

```

I can only assume and continue to research, but has anyone encountered this error or knows what it's referring to?

----------

## Virtuous

Here es my situation :

I already do the 7 button config in XFRE.... 

Same for xmodmap and imwheel

Now the real problem is that when asign imwheel -k -b "67"  all four buttons (MouseWheelUP-MouseWheelDown-SideButton1-SideButton1) are afected in the same way, now when I scroll down It do the Scroll + Fordward, and when a press de side button for forward it make and scrool + fordward.

If I kill imwheel all four buttons only scroll.

I'm running SuSE 9.1 and a Logitech MX310 mouse.

I Really need some kind of help to solve this problem.

Thanxs.

----------

## avunculus

Just wanted to add that at least with the version of firefox that I'm running (0.9.3), and with my Logitech MX700 mouse, imwheel is completely unnecessary. If you use xmodmap the way it's indicated, your thumb buttons should be happily mapped to browser forward/back.

----------

## R!tman

Thanks for the HowTo, I will need this with my new mouse.

----------

## eeknay

uhm, works fine except that the two side buttons don't work like they're supposed to. 

BUT, pressing down the wheel and moving it for-/backward it does act like the 2 side buttons should like.   :Rolling Eyes:   :Question:   :Question: 

eeknay

----------

## WarnK

I have an logitech mx510, and use fluxbox.

edit: im just stupid.

But! What I really want to do is swtich workspaces with my now working side buttons in fluxbox,  can't see how to set up .imwheelrc right to do that.

----------

## FFred

I'm reposting here what I posted in kernel / hardware in the hope that this thread is more appropriate. My mouse has 12 buttons so things get a bit more complicated  :Smile: 

Ok...

I insrtalled my MX 1000 (picked because it was the only one with more than 3 buttons and I needed to replace my mouse right away) which works fine as a 3 button mouse. Attempts to make all buttons work however have all failed.

With evdev enabled both in the kernel (2.6.7-gentoo-r11 on amd64) and in X (X.org 6.7.0-r2) I get the following when testing with xev :

After running xmodmap -e "pointer = default" to reset everything...

button 1 (left mouse) : 1

button 2 (wheel) : 2

button 3 (right button) : 3

wheel up : 9

wheel down : 10

wheel left : no event

wheel right : no event

button above wheel : 9

button below wheel : 10

forward thumb button : 5

back thumb button : 4

middle thumb button : no event

So I only get the following buttons :

1 2 3 4 5 9 10

which is 7 out of 12 if I count the redundant codes.

The relevant section of my xorg.conf is :

Section "InputDevice"

# Identifier and driver

# Settings for Logitech MX1000 12 button mouse

Identifier "Mouse1"

Driver "mouse"

Option "Protocol" "evdev"

Option "DevName" "ImExPS/2 Logitech Explorer Mouse"

Option "DevPhys" "isa0060/serio1/input0"

Option "Device" "/dev/input/event0"

Option "Buttons" "12"

Option "ZAxisMapping" "9 10 11 12"

Option "Resolution" "800"

EndSection

So is there a way to get a distinct event per button ?

And is there a logic behind the order of the button numbers as set with x:modmap ? I haven't quite figured how to create the sequence...

----------

## BootNinja

I've gotten my wheel and thumb button working now, but I want to map my mousewheel button to browser forward.  I tried modifying my imwheel argument to say -b "62" but it doesn't work.

also, whenever I run Imwheel manually I get the following error message;

 *Quote:*   

> 
> 
> Expected 3 args, got 2, in config.
> 
> Downalt_LRight
> ...

 

my .imwheelrc file looks like this:

 *Quote:*   

> 
> 
> ".*"
> 
>   None, Up,        Alt_L|Left
> ...

 

any help would be great!

----------

## arnvidr

You're missing a comma

 *Quote:*   

> 
> 
> ".*"
> 
>   None, Up,        Alt_L|Left
> ...

 

Should be

```
None, Down, Alt_L|Right
```

----------

## BootNinja

I figured it was something stupid like that.  thanks a bundle.  problem fixed.

----------

## arnvidr

I'm seeing weird shit here now:

My scroll-wheel, on scrolling down, not only does it scroll down, it also goes back one step in my browser history!!!

I have a 4-button mouse (one of them a scrollwheel) so I tried this configuration:

/etc/X11/Xmodmap:

```
pointer = 1 2 3 5 6 4
```

~/.imwheelrc:

```
".*"

 None, Up,   Button1|-Button1|Button1

"(null)"

 None, Up,   Button1|-Button1|Button1

```

That's for making the thumb-button doubleclick, see?

And in my initscript I have this:

```
imwheel -k -b "56" -f
```

Everything works the way it's supposed to, except that when scrolling down in firefox, it's as if I pressed Alt+Left at the same time. I figured there might be some funny business in /etc/X11/imwheel/imwheelrc, so I commented out everything in there, but still not any better. Any ideas?

----------

## cdine

Cool, it all works great on my FreeBSD box as well.

I have a USB Explorer, and "Auto" works instead of "Explorer/PS2"

Thanks alot!

----------

## hazelnusse

I have tried all sorts of tricks to get my wheel to work but to no avail.  I have a Logitech MX 700.  The weird thing is that when I do:

```
cat /dev/psaux
```

I get all sorts of output from just moving the mouse and clicking the buttons --- except NO output when I scroll the mouse wheel.  Any ideas why this would be?  I've gotten my thumb buttons to respond within KDE using various combinations of imwheel and modifying the XFree86 file, but nothing is getting any response from the wheel. 

Is there a kernel option that is required to be compiled to get this to work?  I only compiled the following into the kernel:

```

DEVICE DRIVERS-->Input Device Support-->

[*]   Provide legacy /dev/psaux device,     

[*] Mice

<*>   PS/2 mouse      

```

Should I have done more?

Luke

Gentoo 2.6.9-r9

Stage 1 BABY!

3D Acceleration in KDE with Ati Radeon 9600XT && kernel 2.6.9!!! -- booyah

----------

## Krieger

Hello.

I followed this guide, and my Intellimouse optical now works great in my browser.

I have a question for those more experienced than myself:

Q: Is there a way to map a specific button to a specific keystroke?

     --> If so, how would one do it for a specific application?

Ex: I want to emerge the RTCW/ET FPS games.  I need to map my mouse side buttons (forward/back for a browser) to the keystrokes 'o' and 'j'.

Please excuse the simple nature of my question, I'm still learning Linux in general and Gentoo in particular.

Any help is appreciated.

----------

## firephoto

Just go into the game settings and change the mapping for whatever action you want and it will show button 4 or button 5 or whatever button it detects. Games don't use your normal button mapping, they just use the raw button code.

If you want specific keystrokes for normal apps, you can use xbindkeys and xvkbd and it will map a button to a keystroke sequence. I use this for my forward/back/up functions in my browser/file manager since these are standard key sequences for many applications so I don't need app specific key commands.

----------

## monotux

 *Joffer wrote:*   

> Why? Doesn't xfce4 support ~/.xinitrc? (Apparantly not, since I've got those line in my .xinitrc and it isn't invoced when I startxfce4.
> 
> Just a quick sidequstion - what should I put in XSESSION in rc.conf to start xfce4 as default?

 

You can append "startxfce4" to your ~/.xinitrc, and start x with "startx" (and yes, it does work)  :Smile: 

----------

## Krieger

UPDATE:

The Linux version of RTCW (nicely) recognizes the mouse buttons.  I will next emerge ET, which I'm sure will do the same.  Now if only ATI would support Linux users and write some better video drivers for us  :Wink: .

Thank you for the assistance.

 *Quote:*   

> Just go into the game settings and change the mapping for whatever action you want and it will show button 4 or button 5 or whatever button it detects. Games don't use your normal button mapping, they just use the raw button code. 
> 
> If you want specific keystrokes for normal apps, you can use xbindkeys and xvkbd and it will map a button to a keystroke sequence. I use this for my forward/back/up functions in my browser/file manager since these are standard key sequences for many applications so I don't need app specific key commands.

 

Thank you for the response.

The reason I asked is because the two games mentioned contain no facility for changing the mapping as they do not acknowledge/recognize  side mouse buttons at all- at least in MSWindows.  I'll emerge the games and test for side button event recognition on my gentoo box (I'm trying to completely abandon use of Windows).

I will, however, look into xbindkeys.

----------

## R.D.Olivaw

Hello all,

I have an optical mouse with 9 buttons. I followed the instruction (or at least tried to  :Smile:  ) but still have the following probs.

left/right wheel does not work

side buttons produce a arrow left/arrow right effect in firefox as opposed to the desired alt+arrow

```

.imwheelrc

".*"

 None, Thumb1, Alt_L|Left

 None, Thumb2, Alt_L|Right

xorg.conf

    Identifier  "Mouse1"

    Driver      "mouse"

    Option "Protocol"    "ExplorerPS/2"

    Option "Device"      "/dev/mouse"

    Option "Buttons" "9"

    Option "ZAxisMapping" "6 7 8 9"

```

Any insights would be highly appreciated  :Smile: 

----------

## -=LeXuS=-

Hi,

nice topic. But ive got a problem. My mouse is a 7button MS Explorer. I think the 9 button method will do the job for me better than the 7 one (sometimes ive attaching another mouse). 

Here are my Xorg.conf snippet:

```

Section "InputDevice"

        Identifier      "USBMouse"

        Driver          "mouse"

        Option          "Protocol"      "ExplorerPS/2"

        Option          "Device"        "/dev/input/mice"

        Option          "ZAxisMapping"  "6 7 8 9"

        Option          "Buttons"       "9"

        Option          "Emulate3Buttons"       "off"

EndSection

```

This is the output from xorg (which does what i tell above):

```

(**) Option "Device" "/dev/input/mice"

(**) Option "Buttons" "9"

(**) Option "Emulate3Buttons" "off"

(**) Option "ZAxisMapping" "6 7 8 9"

(**) USBMouse: ZAxisMapping: buttons 6, 7, 8 and 9

(**) USBMouse: Buttons: 9

(**) USBMouse: SmartScroll: 1

```

But xmodmap says i only have  7 button!!! 

```

foo@foo$ xmodmap -pp

There are 7 pointer buttons defined.

    Physical        Button

     Button          Code

        1              1

        2              2

        3              3

        4              4

        5              5

        6              6

        7              7

```

Any ideas??

Bye Dan

----------

## Headrush

My guess is the ExplorerPS/2 driver doesn't support that many buttons.

I use the evdev driver and can use all 10 buttons on my MX700.

----------

## Sheepdogj15

It should be noted that the setup for mutlibutton mouse has to be done differently in AMD64. this is because xmodmap on AMD64 for some reason makes it so your system no longer sees the extra buttons (this may have changed in recent updates of Xorg... it was a while since i had to mess with this). 

at the time i already had a partition set up for a 32bit Gentoo environment. so what i did was instead of using the native 64bit xmodmap, i used the one on the other Gentoo partition. i.e.,

```
mnt/g32/usr/X11R6/bin/xmodmap -e "pointer = 1 2 3 6 7 4 5"
```

of course, "g32" is the name of the mount point where the 32 bit Gentoo env can be found... substitute as appropriate for your system. if you have the 32bit compatibility setup on your system, this should work without problem. you can test it by opening the Terminal in X and running "xev"

```
xev
```

this allows you to see what the system "sees" every time you type or use your mouse. 

if you want to stick to the default functionality for your mouse, you do not need imwheel. however, i prefer a customized setup where the extra buttons are set to "copy" and "paste", and this setup is the same regardless of the app i'm using. instead, i use xbindkeys and xvkbd.

unfortunately, imwheel, xbindkeys, and xvkbd are all masked in portage from AMD64. so i chrooted into my 32bit env and emerged xbindkeys and xvkbd there (i'm sure there is a viable way to do that locally in AMD64, but i'd just prefer to keep my local env from getting cluttered with crap as much as possible). then after you exit the chroot, you can start xbindkeys like so:

```
mnt/g32/usr/bin/xbindkeys
```

but note that it won't do you any good unless you have a file in your home folder called ".xbindkeysrc". 

Note that to have this all up and running every time you startx, make your .xinitrc look like this:

```
mnt/g32/usr/X11R6/bin/xmodmap -e "pointer = 1 2 3 6 7 4 5" &

mnt/g32/usr/bin/xbindkeys &

exec startkde
```

if you are left handed like me  :Wink:  change pointer to "pointer = 3 2 1 6 7 4 5"

[note: of course if you don't use KDE, switch "startkde" with whatever's appropriate for your windows manager.]

Like i said, .xbindkeysrc has to be set up so we can switch out various buttons for functions. xbindkeys will use xvkbd for this purpose, but note that xvkbd will probably not work "out of the box." to get it to work, you need to copy a library over from the 32bit install over to the 64bit install.

```
cp mnt/g32/usr/lib/libXaw3d.so.8 /usr/lib/libXaw3d.so.8
```

though, you should probably make sure you won't end up overwriting a copy of the same file, as it might be needed by something else could even be different under the AMD64 env. if this file already exists, try running xvkbd from the terminal:

```
/mnt/g32/usr/X11R6/bin/xvkbd
```

if this returns with an error, then this won't work. unfortunately, i had nothing but bad luck with imwheel in AMD64, but you might be able to get that to work instead.

otherwise, if you enter the above and you get an interface for keyboard input (this is afterall, a virtual keboard daemon), then xvkbd works.

In order to reprogram the extra buttons using this setup, we need to add a few lines to .xbindkeysrc. this is what mine looks like:

```
"/mnt/g32/usr/X11R6/bin/xvkbd -xsendevent -text "\Cx""

  m:0x10 + b:2

"/mnt/g32/usr/X11R6/bin/xvkbd -xsendevent -text "\Cc""

  m:0x10 + b:6

"/mnt/g32/usr/X11R6/bin/xvkbd -xsendevent -text "\Cv""

  m:0x10 + b:7
```

by all means, change this setup to suit your purposes. consult the man pages for xvkbd and xbindkeys for how to use the syntax. note that b:6 and b:7 are the extra buttons, and b:2 is the wheel click button (i never used it for anything else anyways).

that should work. test it out, and hammer out any bugs along the way.

----------

## CyberCobra5

I followed the howto, but it's not working for some reason.

My left + right buttons work normally, but the forward thumb button now scrolls down, and the back thumb button scrolls up.

Also, the scroll wheel and up/down scroll buttons don't work.

However, the scrollwheel on my Logitech Cordless keyboard does work.

Interestingly, when I run imwheel manually w/ no opts from an xterm, the thumb buttons work properly, but the scrollwheel + scrollbuttons still don't work.

My display manager is GDM.

My settings:

.xinitrc:

```

xmodmap -e "pointer = 1 2 3 6 7 4 5"

imwheel -p -f -k -b "67"

exec gnome-session

```

.imwheelrc

```

"(null)"

None, Up,   Alt_L|Left

None, Down, Alt_L|Right

".*"

None, Up,   Alt_L|Left

None, Down, Alt_L|Right

```

xorg.conf

```

Section "InputDevice"

    Identifier  "Mouse1"

    Driver      "mouse"

    Option      "Protocol"     "ExplorerPS/2"

    Option      "Buttons"      "7"

    Option      "ZAxisMapping" "6 7"

    Option      "Device"       "/dev/mouse"

EndSection

```

----------

## Sheepdogj15

run xev in the console in X... a little box will come up. when you do stuff with the mouse over that box, it reports back what mouse events.

does it say anything when you click the misbehaving buttons?

----------

## Headrush

 *Sheepdogj15 wrote:*   

> It should be noted that the setup for mutlibutton mouse has to be done differently in AMD64. this is because xmodmap on AMD64 for some reason makes it so your system no longer sees the extra buttons (this may have changed in recent updates of Xorg... it was a while since i had to mess with this). 

 

I think maybe you have a problem with your setup.

I'm on AMD64 and xmodmap works just fine. What version of xorg-x11 are you running?

----------

## Sheepdogj15

oh i got it fixed ages ago, dude. i don't remember what i did differently, though (maybe just upgraded xorg?)

----------

## CyberCobra5

Okay, I ran xev, and under my setup, the button-symbol correspondence came out like this:

left - 1

right - 3

(scroll) up -6

(scroll) down - 7

thumb forward - 5

thumb back - 4

Any ideas?

----------

## Sheepdogj15

hmmm... it looks like you aren't getting your xmodmap settings. 

try running xmodmap while in X/gnome: xmodmap -e "pointer = 1 2 3 6 7 4 5"

----------

## CyberCobra5

running xmodmap from gnome makes it work.

but if i run imwheel in gnome after the xmodmap command, the scrollwheel starts acting as back/forward buttons.

Is there some place I should move the xmodmap command to?

And do I need to modify my .imwheelrc?

----------

## Sheepdogj15

actually, yeah. your .imwheelrc is set up so your scroll wheel (up and down). if i remember right, it should be "left and right" ... that is, 

```
"(null)"

None, Left,   Alt_L|Left

None, Right, Alt_L|Right

".*"

None, Left,   Alt_L|Left

None, Right, Alt_L|Right 
```

this is because some mice had thumbsticks or something like that, where up and down were like scroll wheels and you could move it left and right. 

actually, try that before you change your .xinitrc

----------

## CyberCobra5

nope, didn't work.

scroll wheel still non-functional and thumb buttons are acting as scroll buttons

----------

## Sheepdogj15

ok, new question: are you using a graphical logon, eg. xdm? because i could have sworn you could put that stuff in your.xinitrc, but i run kdm and as a result .xinitrc is ignored.

----------

## CyberCobra5

As I said earlier, I use GDM, the Gnome display manager.

UPDATE: I might have hit paydirt. looking over GDM's Xsession file, it uses the file ~/.Xmodmap to change Xmodmap settings. I should be able to use gnome's session feature to start imwheel. I'll report back shortly.

----------

## Sheepdogj15

 *CyberCobra5 wrote:*   

> As I said earlier, I use GDM, the Gnome display manager.

 

sorry, lousy memory at times. yeah, i think that's the problem.

 *Quote:*   

> UPDATE: I might have hit paydirt. looking over GDM's Xsession file, it uses the file ~/.Xmodmap to change Xmodmap settings. I should be able to use gnome's session feature to start imwheel. I'll report back shortly.

 

cool. i was going to say that i didn't know how Gnome handles that stuff but figured it does

----------

## CyberCobra5

Fixed it!

I used ~/.Xmodmap and gnome's sessions and it's working like a charm. I've updated the wiki version of this guide accordingly.

meowsqueak, if you could link to the wiki version of the howto it would be handy. Wiki-version of the howto: http://gentoo-wiki.com/HOWTO_Mouse_Nav_Buttons

Purely for searchability: gdm, gnome, logitech mx700, forward/back buttons

----------

## Remillard

Has anyone ever gotten the Tilt Wheel "buttons" to work?  I've looked in xev and it doesn't even seem create an event for this, so I'm not sure how the mouse is suppose to send this contact.

----------

## Sheepdogj15

i'd expect a tilt wheel to count as 5 button events. have you changed your xorg.conf to have 7 buttons (or more if you have more than 2 "regular" buttons)?

if it's not reporting in xev, then either it's an xorg.conf issue or your mouse simply will not work in X (and these days, i consider the latter to be highly unlikely).

----------

## Xithix

I can't get my scroll wheel to work.  I don't think it's a problem with my xorg.conf but I'll post it anyway:

```
Section "InputDevice"

   Identifier  "Mouse0"

   Driver      "mouse"

   Option       "Protocol" "ExplorerPS/2"

   Option       "Device" "/dev/input/mice"

   Option       "Buttons" "5"

   Option       "zAxisMapping" "4 5"

EndSection
```

I have tried protocols ExplorerPS/2, auto, and ImPS/2

The problem is when I 

```
cat /dev/input/mice
```

 There is no garbage on the screen when I scroll.  Same thing happens with /dev/input/mouse0.   Perhaps I'm missing a kernel driver?  Here's the part of my menuconfig I think is relevant.  I'm running gentoo-sources 2.6.11-r6 on a  udev system. 

```
  │ --- Userland interfaces

  │ --- Mouse interface

  │ [ ]   Provide legacy /dev/psaux device

  │ (1024) Horizontal screen resolution

  │ (768) Vertical screen resolution

  │ < > Joystick interface

  │ < > Touchscreen interface

  │ < > Event interface

  │ < > Event debugging

  │ --- Input I/O drivers

  │ < > Gameport support

  │ < > Serial port line discipline

  │ < > ct82c710 Aux port controller

  │ < > PCI PS/2 keyboard and PS/2 mouse controller

  │ < > Raw access to serio ports

  │ --- Input Device Drivers

  │ --- Keyboards

  │ < >   Sun Type 4 and Type 5 keyboard support

  │ < >   DECstation/VAXstation LK201/LK401 keyboard support

  │ < >   XT Keyboard support

  │ < >   Newton keyboard

  │ [*] Mice

  │ <*>   PS/2 mouse

  │ < >   Serial mouse

  │ < >   DEC VSXXX-AA/GA mouse and VSXXX-AB tablet

  │ [ ] Joysticks

  │ [ ] Touchscreens

  │ [ ] Misc

=======================================

--- USB Input Devices

  │ │          <*> USB Human Interface Device (full HID) support

  │ │          [*]   HID input layer support

  │ │          [ ]     Force feedback support (EXPERIMENTAL)

  │ │          [ ]   /dev/hiddev raw HID device support

  │ │          < > Aiptek 6000U/8000U tablet support

  │ │          < > Wacom Intuos/Graphire tablet support

  │ │          < > KB Gear JamStudio tablet support

  │ │          < > Griffin PowerMate and Contour Jog support

  │ │          < > MicroTouch USB Touchscreen Driver

  │ │          < > eGalax TouchKit USB Touchscreen Driver

  │ │          < > X-Box gamepad support

  │ │          < > ATI / X10 USB RF remote control

```

My mouse is a USB Logitech BJ-58.  Don't be fooled by the PS/2 connector in the picture; it's a converter.  

I have not installed the 800dpi logitech-applet or the fast polling hack.

----------

## Sheepdogj15

hmmmmm... i could have sworn you needed a different driver in your xorg.conf, because it's USB, not PS/2. i don't remember what it was called, though.  :Confused: 

----------

## Headrush

I don't know if it makes a difference but maybe try "IMPS/2" and not "ImPS/2".

Can you post the relevant part of /var/log/Xorg.0.log?

----------

## Xithix

Posting the relevent log lines in the order that they appear, and breaking a ine when there's stuff in between relevent lines.

```
(==) Log file: "/var/log/Xorg.0.log", Time: Thu Jul 14 12:51:36 2005

(==) Using config file: "/etc/X11/xorg.conf"

(**) |-->Input Device "Mouse0"

(II) Module ABI versions:

        X.Org XInput driver : 0.4

(**) Option "Protocol" "ExplorerPS/2"

(**) Mouse0: Device: "/dev/input/mice"

(**) Mouse0: Protocol: "ExplorerPS/2"

(**) Option "CorePointer"

(**) Mouse0: Core Pointer

(**) Option "Device" "/dev/input/mice"

(**) Option "Buttons" "5"

(==) Mouse0: Emulate3Buttons, Emulate3Timeout: 50

(**) Option "ZAxisMapping" "4 5"

(**) Mouse0: ZAxisMapping: buttons 4 and 5

(**) Mouse0: Buttons: 5

(**) Mouse0: SmartScroll: 1

(II) 3rd Button detected: disabling emulate3Button

```

There's nothing about emuilate 3 button in my xorg.conf.  I believe it's case insensitive (Everyone puts "zAxisMapping" in their config but the log shows "ZAxisMapping") but I did try IMPS/2 - same issue .. scroll doesn't work or even display output from 

```
cat /dev/input/mice
```

----------

## Sheepdogj15

have you tried 

```
Option       "Device" "/dev/psaux"
```

 instead of 

```
Option       "Device" "/dev/input/mice" 
```

?

----------

## Xithix

```
/dev/psaux: No such file or directory
```

----------

## Xithix

When I use my USB-to-PS/2 converter the light on my mouse turns on but neither /dev/input/mice nor /dev/input/mouse0 produce ANY output for it and the mouse does not work at all, inside X or using gpm.  No other mouse devices popped up in /dev either.  Hotplug and Codplug are both started in the default runlevel.  If I hotplug it back into usb it works, but not the scroll wheel, as expected.

Edit:  The wheel works in Windows

----------

## Kenji Miyamoto

Which model do you have?

I can't place an xsession or .xinitrc in my home directory; X starts up for a second, then quits without even the cursor appearing.  Is there another place I can place xmodmap into, until I can get KDE running?

----------

## playahater

I have one question .. 

I have set that side buttons do left and right .. BUT .. 

can it be set that side buttons do Close and Maximize/Minimize ??

----------

## soigres

i have a mouse with 6 buttons (has only one nav left button, not the right one)... i says in the xorg.conf that i have 6 buttons or 7 (tried all) but when i type xmodmap it says that i have 12 buttons... so i fill with 8 9 10 11 12 the command but the wheel still remains the nav and the nav is the wheel... what to do???

----------

## gettons

Hello to everybody, i 've read the how-to , but at his time I can't use the buttons properly.

On the x server I can use all the buttons , but they are "crossed", I explain better my situation.

I've a Logitech Cordless Optical Mouse , I've found it in the ULTRAX CORDLESS MEDIA DESKTOP pack.

If you want to see it go to this url   http://www.linux-onlineshop.de/images/product_images/popup_images/722_1.jpg

My mouse have 1 left button, 1 right button , one wheel ( that you can also click on right and left ) , and two side buttons.

This is my configuration on xorg

 *Quote:*   

> 
> 
> Identifier  "Mouse1"
> 
>    Driver      "mouse"
> ...

 

and this is my .xinitrc

 *Quote:*   

> 
> 
> #exec afterstep
> 
> exec gnome-session
> ...

 

and this is my .imwheelrc

 *Quote:*   

> 
> 
> ".*"
> 
>  None, Up,   Alt_L|Left
> ...

 

I need help..   :Confused: 

So, if I click up and down on wheel I go back and forward....and if I click on the side buttons I scroll the page ON FIREFOX, and also during the browse with nautilus.

Thanks so much.

P.S. = Sorry for my English, I'm an Italian

----------

## discostu

In my configuration I have an IBM mouse with left, right, scroll wheel, and 1 thumb button (or side button or whatever you call it). I set it up so that my scroll up and scroll down perform the default functions, but the scroll wheel is not the middle mouse button. I found it more convenient (for pasting text) to use the thumb button.

There's only 1 annoyance. The mouse wheel is sometimes kinda sticky and upon scrolling up or down I often click it down. In firefox, this seems to send me back in history. I know pressing shift+scroll down should send me back in history (and it does) but I can't figure out why pressing the scroll button does this too. I guess it's probably because the thumb is supposed to do this and I switched them. Any suggestions.

xorg.conf:

```
Section "InputDevice"

    Identifier  "Mouse1"

    Driver      "mouse"

    Option      "Protocol"      "Auto"

    Option      "Device"        "/dev/input/mouse0"

    Option      "Buttons"       "6"

    Option      "Emulate3Buttons"       "no"

    Option      "ZAxisMapping"          "5 6"

EndSection

```

```
$ xmodmap -pp

There are 6 pointer buttons defined.

    Physical        Button

     Button          Code

        1              1

        2              6

        3              3

        4              2

        5              4

        6              5
```

BTW, I am not using imwheel. I just assume not use it, unless necessary.

Thanks.

----------

## SJWackness

I could use a bit of support if anyone has information that may be of help to me.

I have an IntelliMouse Explorer for Bluetooth and while the mouse and keyboard perform all basic functions, I cannot get the scroll wheel or side buttons working.  I have used xmodmap -e "pointer = 1 2 3 6 7 4 5" and ran xmodmap -pp and it shows that the buttons are correctly assigned.  The problem occurs when I run xev.  When I move the mouse into the box, only the left and right buttons and the wheel click show an event.  I get nothing for the scroll wheel or side buttons.  What am I missing?

----------

## Ranju

Hello

I tried to follow the explained steps, but mouse is not working. I have a Logitech PS/2 with wheel and 6 Buttons (one is the wheel).The 6th Button should start the command "3ddesk" (a little Program t show the Desktop in 3D view).

1.Till now the 6th Button did the same action as the 1rst.

I changed the entries in "xorg" as it has been explained and restarted, but now the 6th Button does not show any event in "xev".

2.I have written the Program imwheelrc with following content

".*"

None, Left, 3ddesk

and tried to run it, but command not found.

How to make the 6th Button work?

How to write a script to start "3ddesk" with the 6th Button?

Regards

----------

## thedeadlyquiche

 *meowsqueak wrote:*   

> Got one of those Microsoft Explorer/Intellimouse mice with the extra buttons? Ever wondered how to get those buttons working in X? Wonder no more...
> 
> (This has been tested with a Microsoft Intellimouse Optical and should work with the Explorer too. I would like people to try this out for themselves please and report back on what other mice work or don't work with this method).
> 
> A typical configuration for such mice often looks like this [XF86Config]:
> ...

 

I followed this exactly and when I ran startx it crashed my system and required a hardrestart.  I will not be trying this again because it screwed up my gnome install.

----------

## fbvortex

So with the correct options for mouse protocol, ZAxisMapping, and xmodmap, I've gotten my USB 4-button + scrollwheel mouse to work correctly in XOrg 6.8.2 .  The 4th button generates a Button-6 event, which is interpreted as a "Back" navigation event in programs like Firefox and Konqueror.  I am not using imwheel.

However, what I would like to do is map the fourth button to a double-click of Button-1, X-wide.  It doesn't seem like I can do this with xbindkeys & xvkbd or any other commonly suggested program(s).  Have I missed something and can imwheel or xbindkeys & xvkbd do what I want?  If not, how can I consume the Button-6 event and turn it into a double click of Button-1?

Thanks.

----------

## meowsqueak

 *thedeadlyquiche wrote:*   

> I followed this exactly and when I ran startx it crashed my system and required a hardrestart.  I will not be trying this again because it screwed up my gnome install.

 

Unfortunate.

----------

## meowsqueak

For interest, I have not yet managed to get this to work for xorg-7.0. Still working on it. If anyone else figures it out before I do, please post here.

----------

## downey

I haven't been able to get this to work either with X.org 7.0.  It was working fine before upgrading and now my side buttons are gone.  The only thing that I'm seeing which is odd is that X is now reporting that I have 11 buttons instead of 7 on my mouse.  I'm using a MicroSoft Intellimouse.  Here is my xorg.conf section:

```
Identifier  "Mouse1"

Driver      "mouse"

Option "Protocol"    "ExplorerPS/2"

Option "Device"      "/dev/input/mouse0"

Option "Buttons"    "7"

Option "ZAxisMapping" "6 7"
```

X is seeing the "Buttons" "7" option but is ignoring it and saying that I have 11 buttons.  Any ideas?

----------

## downey

After a bit of messing around with xev and the config utility I was able to get it to work with X.org 7.0.  Here's what I found:

1) The X server does seem to always see my mouse as having 11 buttons even if I use the Option "Buttons" "7".  Couldn't seem to fix that.

2) There appears to be a new file ~/.imwheelrc that doesn't work with my configuration.  Not too sure where it came from but I deleted it.

3) I removed my Xmodmap file in /etc/X11 and just use the default.  Before I had it set to do just 

```
pointer = 1 2 3 6 7 4 5
```

4) Changed from using Option          "ZAxisMapping" "6 7" to Option          "ZAxisMapping" "4 5" in my xorg.conf

5) Changed my imwheel command to be just 

```
imwheel -k -b "000089"
```

  I would think if you are letting imwheel control the scroll wheel then you wouldn't need the -b stuff at all.  I don't so I disable the imwheel grabs.

That's it.  Here are my imwheelrc

```
"(null)"

None, Thumb1, Alt_L|Left, 1

None, Thumb2, Alt_L|Right, 1

".*"

None, Thumb1, Alt_L|Left, 1

None, Thumb2, Alt_L|Right, 1
```

and relevant xorg.conf sections

```
Section "InputDevice"

        Identifier      "Mouse0"

        Driver          "mouse"

        Option          "Protocol" "ExplorerPS/2"

        Option          "Device" "/dev/input/mouse0"

        Option          "Buttons" "7"

        Option          "ZAxisMapping" "4 5"

        Option          "Emulate3Buttons" "no"

EndSection
```

Also I'm using a Logitech MX700 mouse.  Now all I need to figure out is why my imwheel command isn't getting run from the /etc/X11/Sessions/Gnome file when Gnome starts up.

----------

## rockandchelle

 *downey wrote:*   

> After a bit of messing around with xev and the config utility I was able to get it to work with X.org 7.0.  Here's what I found:
> 
> 1) The X server does seem to always see my mouse as having 11 buttons even if I use the Option "Buttons" "7".  Couldn't seem to fix that.
> 
> 2) There appears to be a new file ~/.imwheelrc that doesn't work with my configuration.  Not too sure where it came from but I deleted it.
> ...

 

I know this is an old post, but I just wanted to let you know I found a way to get it to star when Gnome starts.  Now, this probably isn't the cleanest approach, but it does work. 

Inside of  /etc/X11/xinit/xinitrc.d create a file called imwheelrc.

Inside that file put:

```
imwheel -k -b "000089"
```

Then save that file, you will have to do this as root.  Next make this file executable using the following command:

```
chomd +x imwheelrc
```

And that should be all you have to do, next time the gnome starts it should load it, now this is global for everyone, just not one user.

I hope this helps, I am still learning but just wanted to let you know my success.

----------

## bammbamm808

I have a logitech MX310 USB and "lost" my extra buttons unser xorg 7.0, like others here. I got it to work as before by the following. Oh, and I have NEVER used mwheel for the simple functionality I need. (Having the buttons available for games, and "back" and "forward" in Firefox)

xorg.conf:

    Identifier  "Mouse1"

    Driver      "mouse"

    Option "Protocol"    "ExplorerPS/2"

    Option "Device"      "/dev/input/mice"

    Option "Buttons" "7"

    Option "ZAxisMapping" "4 5"

script in my xfce ~/Desktop/Autostart to run xmodmap:

xmodmap -e "pointer = 1 2 3 4 5 8 9 6 7" &

Oh and here's what xmodmap -pp gives me:

There are 11 pointer buttons defined.

    Physical        Button

     Button          Code

        1              1

        2              2

        3              3

        4              4

        5              5

        6              8

        7              9

        8              6

        9              7

       10             10

       11             11

I think the upshot is that the 6.x mouse driver wanted the side buttons to be 6 & 7 and the new 7.x one wants them to be 8 & 9. Don't ask me why my mouse now has 11 buttons to X, though.

----------

## Drunkula

Now this may be a stupid question.  Where the heck did xev go?  I was trying to determine what button my ONLY thumb button should be.  I was hoping to make it act like a "Back" button in Firefox.  But alas, xev is nowhere to be found in my setup.  Is it no longer part of xorg-x11 7?

```
 equery l xorg-x11

[ Searching for package 'xorg-x11' in all categories among: ]

 * installed packages

[I--] [  ] x11-base/xorg-x11-7.0-r1 (0)

```

Incidentally my mouse is a Logitech "Cordless MouseMan Optical" according to the label on the bottom.  For the most part I am working except that thumb button and the middle button (on the wheel) does not paste anymore.

----------

## discostu

 *Drunkula wrote:*   

> Now this may be a stupid question.  Where the heck did xev go?  I was trying to determine what button my ONLY thumb button should be.  I was hoping to make it act like a "Back" button in Firefox.  But alas, xev is nowhere to be found in my setup.  Is it no longer part of xorg-x11 7?
> 
> ```
>  equery l xorg-x11
> 
> ...

 

Here:

x11-apps/xev

     Available versions:  1.0.1 1.0.2

     Installed:           1.0.2

     Homepage:            http://xorg.freedesktop.org/

     Description:         X.Org xev application

----------

## Drunkula

 *discostu wrote:*   

> 
> 
> Here:
> 
> x11-apps/xev
> ...

 

Ahh it was a stupid question then!   :Embarassed:   I would have assumed it would be part of another package.  Thanks Discostu.  Will give it a shot when I get home...

----------

## tkhobbes

Anyone got wheel and extra button working with a MS Intellimouse Explorer for Bluetooth?

I am struggling for months now - all howto's I found did not work... I don't know whether it's bluetooth or what else, but my system does not even recognise a mouse when issueing "cat /proc/bus/input/devices":

```
I: Bus=0011 Vendor=0001 Product=0001 Version=ab41

N: Name="AT Translated Set 2 keyboard"

P: Phys=isa0060/serio0/input0

S: Sysfs=/class/input/input0

H: Handlers=kbd event0 evbug

B: EV=120013

B: KEY=4 2000000 3802078 f840d001 f2ffffdf ffefffff ffffffff fffffffe

B: MSC=10

B: LED=7

I: Bus=0005 Vendor=045e Product=0098 Version=0010

N: Name="Bluetooth HID Boot Protocol Device"

P: Phys=

S: Sysfs=/class/input/input5

H: Handlers=mouse0 event1 evbug

B: EV=7

B: KEY=1f0000 0 0 0 0 0 0 0 0

B: REL=103

```

Don't know what I should do.... return the mouse?  :Wink: 

----------

## dia

Not sure if this will help anyone but I was having problems with my MS LaserMouse 6000 KB/M combo.

Inside /etc/X11/Xmodmap I put:

```

pointer = 1 2 3 4 5 8 9 6 7

```

This made it to where the left and right click work as normal, the wheel moves up and down as normal(instead of up being backwards in a browser) and the front and back left thumb buttons move forward and backward in a browser, respectively.

Not sure what I had to do to get the thumb buttons bound like that but I really just played with xmodmap -e pointer command for a couple minutes to find what binds to what.

Hope this helps someone...    :Confused: 

----------

