DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Configuring the keyboard for the server

Changing the keymap table

To change the X server's keymap table while it is running, perform the following steps.

  1. Check the current keymap table by entering the following command at the prompt in a scoterm window:

    xmodmap -pk

  2. Change the keysyms attached to a specific keycode by entering the following command in a scoterm window:

    xmodmap -e expression

Step 1: Examining the current keymap table

To view the current keymap table, run the following command in a scoterm window:

xmodmap -pk

A list of keycodes and the keysyms that are associated with them appears. The following is a portion of a typical keymap listing generated by xmodmap -pk:

   There are 2 KeySyms per KeyCode; KeyCodes range from 8 to 150.
   

KeyCode Keysym (Keysym) ... Value Value (Name) ...

8 0xff1b (Escape) 9 0x0031 (1) 0x0021 (exclaim) 10 0x0032 (2) 0x0040 (at) 11 0x0033 (3) 0x0023 (numbersign) 12 0x0034 (4) 0x0024 (dollar) 13 0x0035 (5) 0x0025 (percent) 14 0x0036 (6) 0x005e (asciicircum) 15 0x0037 (7) 0x0026 (ampersand) 16 0x0038 (8) 0x002a (asterisk) 17 0x0039 (9) 0x0028 (parenleft) 18 0x0030 (0) 0x0029 (parenright) 19 0x002d (minus) 0x005f (underscore) 20 0x003d (equal) 0x002b (plus) 21 0xff08 (BackSpace) 22 0xff09 (Tab) 23 0x0051 (Q) 24 0x0057 (W) 25 0x0045 (E) 26 0x0052 (R) 27 0x0054 (T) 28 0x0059 (Y) . . .

Make a note of the keycodes and keysyms that you want to remap.

In the above listing, the keysyms for ``equal'' and ``plus'' are associated with keycode 20. Their order in the table specifies that the ``plus'' keysym corresponds to the shifted key. If you swap their order in the table, however, the ``equal'' keysym corresponds to the shifted key.

Step 2: Specifying keymap table changes

To change the mapping of keysyms to keycodes, run the following command in a scoterm window:

xmodmap -e expression

expression is a quoted string that tells xmodmap how to change the keymap table.

To redefine an entry in the keymap table, expression takes the following form:

keycode keycode_number = keysym_list

keycode_number specifies the keycode of the key you want to remap in the keymap table. keysym_list is a list of keysym names, delimited by spaces, that are mapped to keycode_number. For a list of valid keysyms, examine /usr/lib/X11/xsconfig/keysymdef.h. Note that you must not include the keysym's ``XK_'' prefix in keysym_list.


NOTE: You must leave spaces around the ``='' character.

For example, to attach the bracketleft and braceleft keysyms to keycode 34 (to which bracketright and braceright are currently attached), run the following command in a scoterm window:

xmodmap -e "keycode 34 = bracketleft braceleft"

In this example, the keysyms bracketleft and braceleft are attached to keycode 34, and the keysyms bracketright and braceright are no longer attached.

To replace one keysym with another keysym or list of keysyms, expression takes the following form:

keysym keysym_name = keysym_list

keysym_name is the name of a keysym that is currently mapped to a keycode in the keymap table. keysym_list is a list of keysym names, delimited by spaces, that replace keysym_name in the keymap table. For a list of valid keysyms, examine /usr/lib/X11/xsconfig/keysymdef.h. Note that you must not include the ``XK_'' prefix in keysym_list.

This command is very useful if you want to replace keysym attachments but do not know the keycodes to which they are currently attached. Only the first occurrence of this keysym_name in the keymap table is replaced. If the keysym was mapped to multiple keycodes, you must use this command to find each entry. For example, to attach the keysym Control_L to the keycode to which the keysym CapsLock is attached, run the following command:

xmodmap -e "keysym CapsLock = Control_L"


Next topic: Example of configuring the keyboard
Previous topic: Step 2: Examining the modifier map

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003