Penguin
Note: You are viewing an old revision of this page. View the current version.

Mouse hardware support under XFree86

Side buttons on 7-button mice

Mice like the MS Intellimouse Explorer have 5 buttons, besides the wheel, which means a total of 7 buttons as far as XFree86 is concerned. Here's a summary of how to get the extra buttons working, as outlined in the official XFree developer documentation.

Under XFree86 4.2.x and later, add/change settings in your mouse !InputDevice? section of /etc/X11/XF86Config(-4)
Protocol "ExplorerPS/2" # instead of plain "IMPS/2" Options "Buttons" "7" "ZAxisMapping" "6 7"

Verify that it works by using xev(1) and clicking on the various buttons after restarting your display manager (xdm(8)?/gdm(8)/kdm(8)?/wdm(8)?/...).

You'll probably notice that your mouse wheel doesn't work any more, but the two side buttons act as wheel up/down now. The reason for this is that the application widget sets (eg Qt and GTK) assume buttons 4 and 5 are generated by a wheel, in the same way that they assume a button 3 message was generated by the 3rd mouse button. For some reason the Explorer driver and/or hardware assigns 4 and 5 to the side buttons, and 6 and 7 to the wheel.

To fix this, change the button order
xmodmap -e "pointer = 1 2 3 6 7 4 5"

To have this happen automatically, you could

  1. add it to your .xsession or .xinitrc, which only works per user
  2. assuming you're using gdm(8), add it to /etc/gdm/!PreSession?/Default which affects everyone using gdm(8)
  3. assuming you're using kdm(8)?, add it to ??? - AddToMe

MozillaNotes has examples on how to use these extra buttons for things like going forward/backwards in a browser. Many games also support them.

Using your Keyboard as a mouse

Should you happen to find yourself without a mouse for one reason or another you can use the numpad on your keyboard as a substitute. To enable this feature simply press Shift-!NumLock? (various people report their keyboards' !NumLock? keys even have mouse icons on them - check yours!), which gives you two beeps to signify it's active.

Use 2/4/6/8 as down/left/up/right, respectively. 5 clicks a mouse button, + toggles whether it's the left or right one. * produces a middle-click.

Changing the mouse cursor speed

GNOME and KDE have applets/config settings to change the mouse speed settings. If you prefer to do it manually, or you are running a different window manager/environment, you can use the xset(1) command.

$ xset m 2 4

sets the acceleration to 2 and the threshold to 4. This means that the mouse cursor will be accelerated to double speed when the cursor passes over 4 pixels in a "short time". This means that if you are moving the mouse slow enough (under the threshold), the mouse moves at normal speed, but over the threshold and the cursor is moved faster than normal. The acceleration can be a fraction, eg

$ xset m 5/2 8

will make the cursor go 2.5 times normal speed if the cursor moves over 8 pixels in a short time.

Mouse cursor

Some games on linux (such as Quake2 or BzFlag) don't change the mouse pointer, meaning you get the mouse arrow in the middle of your game.

You can change the shape of the cursor using standard programs that come with XFree86. X also comes with lots of bitmaps for this purpose. The xsetroot(1) program does this. If you give it the -cursor option, the first argument is an xbm to use for the cursor and the second argument is a transparency mask.

A good, minimalist pointer is
$ BMPATH=/usr/X11R6/include/X11/bitmaps $ xsetroot -cursor $BMPATH/opendot $BMPATH/opendot
To restore the cursor back to the original pointer
$ BMPATH=/usr/X11R6/include/X11/bitmaps $ xsetroot -cursor $BMPATH/left_ptr $BMPATH/left_ptrmsk

Keyboards under Xfree86?

If you have a keyboard with 'extra' buttons, you'll probably want to get them to work under X.

MS Natural Pro

I have a MS Natural Pro keyboard, with the 'multimedia' blue buttons across the top. I borrowed the following xmodmap file from JamieCurtis, no idea where he got it from. Problem is, it only works if you use the keyboard via PS/2 - use USB and it has a different set of keycodes! Both are listed below. To use these, place in a file called .Xmodmap in your home directory, and make sure your X login runs xmodmap over this file. This is normally done for you in most systems. Now you can use your window manager to grab these keys and run commands for you.

MS Natural Pro (USB) .Xmodmap snippet

keycode 234 =XF86Back keycode 233 =XF86Forward keycode 232 =XF86Stop keycode 121 =XF86Refresh keycode 229 =XF86Search keycode 230 =XF86Favorites keycode 130 =XF86HomePage keycode 236 =XF86Mail keycode 166 =XF86AudioMute keycode 165 =XF86AudioLowerVolume keycode 158 =XF86AudioRaiseVolume keycode 159 =XF86AudioPlay keycode 151 =XF86AudioStop keycode 164 =XF86AudioPrev keycode 162 =XF86AudioNext keycode 129 =XF86AudioMedia keycode 111 =XF86MyComputer keycode 161 =XF86Calculator keycode 227 =XF86Standby

MS Natural Pro (PS/2) .Xmodmap snippet

keycode 234 =XF86Back keycode 233 =XF86Forward keycode 232 =XF86Stop keycode 231 =XF86Refresh keycode 229 =XF86Search keycode 230 =XF86Favorites keycode 178 =XF86HomePage keycode 236 =XF86Mail keycode 160 =XF86AudioMute keycode 174 =XF86AudioLowerVolume keycode 176 =XF86AudioRaiseVolume keycode 162 =XF86AudioPlay keycode 164 =XF86AudioStop keycode 144 =XF86AudioPrev keycode 153 =XF86AudioNext keycode 237 =XF86AudioMedia keycode 235 =XF86MyComputer keycode 161 =XF86Calculator keycode 223 =XF86Standby

Another way

If you have access/ability to change your X11 settings, http://flag.blackened.net/retch/microsoft-and-xfree86.html suggests that you can put "XkbModel?" "microsoft" in the InputDevice? section for your keyboard, and this will all 'just work'. Not tested this, as I dont have access to the modify my X11 config file -- I can run xmodmap however!

The following authors of this page have not agreed to the WlugWikiLicense. As such copyright to all content on this page is retained by the original authors.
  • SamuelFalvo
The following authors of this page have agreed to the WlugWikiLicense.

lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 2 times)

lib/plugin/WlugLicense.php:99: Warning: Invalid argument supplied for foreach()

lib/plugin/WlugLicense.php:111: Notice: Undefined variable: ignore_authors

lib/plugin/WlugLicense.php:111: Notice: Undefined variable: ignore_authors

lib/plugin/WlugLicense.php:111: Warning: in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument