Using your mouse - gpm

Using your mouse - gpm

So far, we've just been using our keyboard, typing in mysterious commands, looking at the screen with a total amazement waiting for response. Somewhere to the right (or perhaps left, if you're left-handed) there's a weird shaped thing with a cable attached to it, doing nothing at the moment. They usually call it a mouse, or pointing device. Can you use that thing in Linux text mode ? The answer is yes.

The mouse server, gpm.

When you installed your Linux, most probably a mouse server called gpm was installed and perhaps even configured. Gpm is a daemon watching the mouse, and when detecting movement, showing up a mouse pointer on the screen. Gpm is usually started in the init scripts (remember reading about that earlier in this document ? :) ) Command to start gpm could be gpm -t ms -m /dev/ttyS1 if your mouse is of Microsoft type attached to COM2. If you have a PS/2 mouse, try something like gpm -t ms -m /dev/psaux. Anyway, if your mouse server isn't working, read the manual. man gpm will probably give some useful information.

OK, it's running, what can I do ?

You move your mouse and a pointer moves on the screen ? Great ! But what is it good for ?

The basic function of gmp is as a cut and paste utility. You have one Virtual terminal open with a file listing, and want to open one of the files in an editor in another Virtual terminal. Mark the file in the first terminal (hold left button down and mark, then release it) switch to the other one, and paste the text with the right button. Very useful, when you know about it, you'll miss it if it isn't there.

gmp can do other stuff to, if you invoke it with the -S parameter, and then hold your right button and triple-click you left, a message will appear.. if you press one of the buttons again within three seconds, your machine will reboot. Very handy for programmers if the keyboard locks, and he can't telnet in to do a clean reboot. It's possible to specify what should be done instead of rebooting.