UNIX Hints & Hacks |
|||||||||||||||||||||||||||||||||||||
Chapter 7: Displays and Emulations |
|
||||||||||||||||||||||||||||||||||||
|
Flavors: AT&T, BSD (with X11R6.1 or higher)
If you have the X keyboard (XKB) extension, you have the ability to enable the mouse keys. This makes it possible to generate mouse motion and button events using the keyboard's numeric keypad. Any event generated by MouseKeys is completely transparent and works with any application that connects to a server with the X keyboard extension. The application itself doesn't even have to use XKB. To make this work you have to first set up the Num Lock key so that Shift+Num Lock toggles the mouse keys.
xmodmap -e "keysym Num_lock = Num_Lock Pointer_EnableKeys"
Note - If you are using an earlier version of X, you will not have XKB and these instructions will not work. |
Press Shift+Num Lock to activate the MouseKeys. The following are the default configurations that are set for moving around on the numeric keypad. These are used to substitute for the mouse:
Arrow keys (2, 4, 6, and 8) move the pointer.
The 5 key behaves like the default pointer button.
The 0 key locks the default pointer button for dragging.
The . key unlocks the default pointer button to release a drag.
The + key double-clicks the default pointer button.
The / key sets the default button to Button1.
Sometimes using Shift+Num Lock does not work. In cases such as these, try using Alt+Shift+Num Lock to toggle to the MouseKeys. Check out the man page xmodmap, because it has many options available for mapping keys and is a great resource.
There are rare instances where a mouse can break, become inoperable, or become unplugged. By toggling the keyboard to act as a mouse, you can gracefully shut down applications as well as the system when needed.
Try to have this set up on as many systems as possible. I had a user who went all day without saving any of his work (like many users). While walking around his desk, he kicked the mouse cable and broke not only the connection but the mouse port on the computer. The frantic call came in and I was able to toggle the keyboard to control the cursor, save his data, shutdown the system, and swap out the bad hardware. By the way, his system now sits on his desk.
Man pages:
xmodmap
UNIX Hints & Hacks |
|||||||||||||||||||||||||||||||||||||
Chapter 7: Displays and Emulations |
|
||||||||||||||||||||||||||||||||||||
|
© Copyright Macmillan USA. All rights reserved.