Using a Mouse within the Console
1.
Getting GPM
If you've just installed Gentoo, you almost certainly don't have your mouse set
up to work within a command line interface (CLI) yet. Or perhaps you can't use
or don't need an X server, yet you still need to use a mouse. The solution is
simple: gpm, the General Purpose Mouse server.
First, you will need to get GPM:
Code Listing 1.1: Obtaining GPM |
# emerge gpm
|
You might have noticed a few messages during the compilation that warned about
configuring the server. You must do this before starting GPM.
2.
Configuring GPM
Before you can use GPM, you will need to uncomment the lines corresponding to
the location and protocol of your mouse. You do this by editing the GPM
configuration file:
Code Listing 2.1: Setting up GPM |
# nano /etc/conf.d/gpm
|
In my case, I have a USB mouse on /dev/input/mouse0. So, I have
uncommented /dev/input/mice, as this is the cumulative device for
all mice on the system, and the appropriate protocol. Try using
/dev/input/mice before /dev/psaux, as the latter is
deprecated and can be disabled in the latest 2.6 kernels. If
/dev/input/mice fails, then fall back to other devices. Here is my
example /etc/conf.d/gpm:
Code Listing 2.2: Example GPM config |
#MOUSE=ps2
MOUSE=imps2
#MOUSEDEV=/dev/psaux
MOUSEDEV=/dev/input/mice
|
If you have a wheelmouse, you will want to use the imps2 protocol, so uncomment
that line. If imps2 and ps2 both fail to work for you, please refer to the GPM
info page (info gpm) for other protocols to try. Also, if you want to be
able to click on hyperlinks in terminals to navigate to a website, it is a good
idea to follow the suggestion in the /etc/conf.d/gpm file:
Code Listing 2.3: Other options |
APPEND="-l \"a-zA-Z0-9_.:~/\300-\326\330-\366\370-\377\""
|
The rest of the conf.d file contains other suggestions for your mouse server;
uncomment the various options according to your needs. See man gpm for
more information.
3.
Running GPM
Now that your mouse server is installed and configured, it's time to start
using it:
Code Listing 3.1: The GPM init script |
# /etc/init.d/gpm start
|
You should see a block cursor appear. Remember that only root can run the GPM
init script. However, to avoid having to su and run the script every
single time you begin a new session, why not set GPM to begin every time you
turn on your computer?
Code Listing 3.2: Adding GPM to the default runlevel |
# rc-update add gpm default
|
Now, whenever you start your computer, you'll be greeted by the console cursor
by the time you get to the login prompt. The mouse server will continue to run
even if you're not logged in as root.
4.
Working with GPM
Copying and pasting
Copying and pasting large blocks of text with a working mouse server is very
easy. Simply highlight the text with the left mouse button (it will stay
highlighted when you release the button), switch to a different terminal if you
wish, position the cursor, and press the middle mouse button to paste the text
where you placed the cursor. Note that you can copy and paste without ever
leaving the terminal you started. This makes posting the output of error
messages to the Gentoo Forums
extremely simple.
Text-mode browsing and GPM
If you have a message on one screen and a text-mode web browser on the other,
you can copy the error message by highlighting it, then change to the other
terminal, left-click the appropriate text entry box to select it, and then
press the middle mouse button. Voilà! Your error message can now be posted to
the forums.
Though discussion of text-only browsers is somewhat beyond the scope of this
guide, inevitably users will need to find a compatible console browser. Though
lynx is most likely the oldest and well established browser, its
interface has poor mouse support and recognition. Instead, try using
links which has excellent mouse integration.
Code Listing 4.1: Obtaining links |
# emerge links
|
This concludes the guide to using a mouse within the console. Happy mousing!
The contents of this document are licensed under the Creative Commons -
Attribution / Share Alike license.
|