|
|
Using the X Window System > Chapter 9 Customizing the Mouse and KeyboardGoing Mouseless with the `X*pointerkeys' File |
|
Your work situation may lack sufficient desk space to adequately use a mouse pointer. You may, therefore, want to "go mouseless" by naming the keyboard (or some other input device) as the pointer. To go mouseless, you need to have the proper configuration specified in the X*devices file and to have a special configuration file named X*pointerkeys. The default X*pointerkeys file is X0pointerkeys in /usr/lib/X11. The X*pointerkeys file lets you specify:
If you modify a X*pointerkeys file, it does not take effect until you restart the X Window System again. If you have only one keyboard and no pointer device, and you want the keyboard to serve as both keyboard and pointer, you don't have to change the default configuration of X0devices. The default input device configuration automatically assigns the pointer to the keyboard if a pointer can't be opened by the server. If you have two or more input devices, you may need to explicitly specify which device should be the keyboard and which the pointer. By default, when you configure your keyboard as the pointer, the X server chooses certain number pad keys and assigns them mouse operations. Some number pad keys are assigned to pointer movement; other number pad keys are assigned to button operations. If you don't need to change the pointer keys from their default specifications, you don't need to do anything else to use your keyboard as both keyboard and pointer. However, if you need to change the default pointer keys, you must edit the X0pointerkeys file or create a new X*pointerkeys file. The X*pointerkeys file is the file that specifies which keys are used to move the pointer when you use the keyboard as the pointer. The default key assignments are listed in the tables in the following section on customizing the X*pointerkeys file. You need to modify the existing X0pointerkeys file only if one or more of the following statements are true:
You need to create a custom X*pointerkeys file only if the following statements are true:
You assign a keyboard key to a mouse function (pointer movement or button operation) by inserting a line in the X*pointerkeys file. Lines in the X*pointerkeys file have the syntax: function keyname [# comment] You can assign any mouse function, either a pointer movement or a button operation, to any keyboard key. However, make sure that the key you are assigning doesn't already serve a vital function. You can assign keyboard keys to pointer directions by specifying options in an X*pointerkeys file. The following table lists the pointer movement options, the X*pointerkeys functions that control them, and their default values: Table 9-3 Pointer Movement Functions.
Note that the pointer direction keys are the keypad number keys on the right side of the keyboard, not the keyboard number keys above the text character keys. You can assign keyboard keys to pointer distances by specifying options in a X0pointerkeys file. The following table lists the options that determine the distance of pointer movements, the X*pointerkeys functions that control them, and their default value: Table 9-4 Pointer Distance Functions.
You can assign keyboard keys to mouse button operations by specifying options in a X*pointerkeys file. The following table lists the button operations, the X*pointerkeys functions that control them, and their default values: Table 9-5 Button Operation Functions.
You can change the mapping of buttons on the pointer by using options in the X*pointerkeys file. The following table lists the X*pointerkeys functions that control button mapping and their default values. Like xmodmap and xset, these functions affect only the X pointer, not any extension input devices. Table 9-6 Button Mapping Functions.
You can change the key sequence that exits the X Window System. Also, if you use both image and overlay planes, you can change the distance you must move the pointer before you switch planes. The following table lists these options, the X*pointerkeys functions that control them, and their default values: Table 9-7 Reset and Threshold Functions.
screen_change_amt is used only if your system is configured for more than one screen. (Refer to “Using Custom Screen Configurations”). screen_change_amt enables you to avoid switching from one screen to another if you accidentally run the pointer off the edge of the screen. screen_change_amt establishes a "distance threshold" that the pointer must exceed before the server switches screens. As the previous table shows, the default width of the threshold is 30 pixels, but acceptable values range from 0 to 255. When a graphics tablet is used as the X pointer, the screen_change_amt defines an area at the left and right edges of the tablet surface that will be used to control screen changes. Moving the puck or stylus into the left or right area will cause the X server to switch to the previous or next screen. Table 9-8 Button Chording
Button chording refers to the generation of a button by pressing two other buttons. If you have a two-button mouse, you can generate button 3 by pressing both buttons together. With a three-button mouse, you can generate button 4 by pressing the left and middle buttons together and button 5 by pressing the middle and right buttons together. See the button chording examples in the X*pointerkeys file. You can also use the X*pointerkeys file to configure pointer buttons so they are latched. When this feature is enabled, a button you press stays logically down until you press it again. See the example X*pointerkeys file in /usr/lib/X11 for information on configuring this functionality.
Table 9-9 Specifying a Portion of a Tablet
If a tablet is used as the X pointer device, it may be desirable to use only a portion of the tablet surface. A rectangular subset of the surface may be specified with these functions. The units are in millimeters from the upper left corner of the tablet surface. For example, if you want to use only an "A" size portion of a larger "B" size tablet, the following lines could be added to the X*pointerkeys file:
You can also use the X*pointerkeys file to control screen switching behavior in multi-screen configurations. See the example X*pointerkeys file in /usr/lib/X11 for an example of this functionality.
You can select up to three keys from among the two Shift keys, the two Extend char keys, and the CTRL key and use them each as modifier keys. A modifier key is a key that, when you hold it down and press another key, changes the meaning of that other key. Modifier keys in the X*pointerkeys file have three functions:
For example, you can overcome the problem in the last example by assigning the Left Shift key as a modifier to the pointer direction keys. Now, to move the hpterm cursor to the right, you press right as usual. To move the x server pointer to the right, you press Left Shift right. To find out what key names are valid for the keyboard you are using, enter
You may also use the default X Keysymbol names assigned to these keys by the X Server. If you only have one keyboard and no mouse, and you can live with the default pointer key assignations, you don't have to do anything else to configure your system for mouseless operation. To move the pointer to the left 10 pixels, you would press the 1 key on the keypad. To press mouse button 1 you would press the * key on the keypad. However, suppose you wanted to move only one pixel to the left. Although the default value of pointer_mod2_amt is one pixel, no key is assigned to the modifier for that amount. Thus, you would need to edit the X0pointerkeys file (or create an X*pointerkeys) to include a line assigning one of the modifier keys to pointer_amt_mod2. The following line in X0pointerkeys assigns the Left Shift key to pointer_amt_mod2:
Or suppose you wanted to set up your X0pointerkeys file so that you could move 1, 10, 25, and 100 pixels. The following lines show one way to specify this:
With these lines in effect, one press of the 1 key on the keypad moves the pointer 1 pixel to the left. Pressing the left Extend char and 1 moves the pointer 10 pixels to the left. Pressing Left Shift 1 moves the pointer 25 pixels to the left. And pressing CTRL 1 moves the pointer 100 pixels to the left. Or, take the case previously mentioned where you want to use the arrow keys for both text cursor and mouse pointer. You could insert the following lines in your X0pointerkeys file:
The above lines enable you to use the arrow keys for cursor movement, while using the shifted arrow keys for pointer movement. Note that only the Left Shift key (and not the Right Shift) modifies the press of an arrow key from cursor to pointer movement. Now, suppose you want to use the arrow keys to operate the pointer, and you also need the arrow keys to control the cursor in an hpterm window. Furthermore, another application uses the shift-arrow key sequence to control its cursor. The easiest way to solve this dilemma is to call in another modifier. The following lines illustrate this. Compare them to the previous example.
In this example,
Using a similar technique, you can also reassign the CTRL Left Shift Reset sequence that aborts a session. You can specify the press of a single key or a combination of two, three, or four key presses. Just make sure that the key sequence you select isn't something you're going to type by accident. |
|