Next Previous Contents

8. Using gpm to Switch Mouse Modes

gpm is the program that lets you use the mouse in console mode. It is usually included in linux distributions, and can be started from the command line or in the startup script /etc/rc.d/rc.local. Note that distributions don't always have the most recent version (1.13 at time of writing) which can be found on mirrors of sunsite.unc.edu.

The main modes for serial mice under gpm are:


gpm -t ms
gpm -t msc
gpm -t help

for Microsoft or MouseSystems modes, or to probe the mouse for you and tell you what it found. To run gpm in MouseSystems mode, you may need a -3 flag, and possibly a DTR option, using the -o dtr flag:

gpm -3 -o dtr -t msc

gpm is often able to recognise all three buttons of the mouse even in Microsoft mode. And newer versions (Version 1.0 and later (?)) can then make this information available to other programs. For this to work, you need to run gpm with the -R tag, like this:

gpm -R -t ms
This will make gpm re-export the mouse data to a new device, called /dev/gpmdata, which looks like a mouse to any other program. Note that this device always uses the MouseSystems protocol. You can then set your Xconfig to use this instead of /dev/mouse as shown below, but of course you must ensure gpm is always running when you use X. Some people have reported that some middle-button events are not correctly interpreted by X using this technique, this may be down to an individual mouse setup.

Changing button mapping for gpm and X ( )

You may find that gpm uses different default button mappings to X, so using both systems on the same machine can be confusing. To make X use the same buttons for select and paste operations as gpm, use the X command

xmodmap -e "pointer = 1 3 2"
which causes the left button to select and the right button to paste, for either 2-button or 3-button mice. To force gpm to use the X standard button mapping, start it with a -B command, eg:
gpm -t msc -B 132


Next Previous Contents