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

Changing the modifier map

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

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

    xmodmap -e expression

    Repeat this step for every modifier map change you want to make.

  2. Check the current modifier map by entering the following command at the prompt in a scoterm window:

    xmodmap -pm

Step 1: Changing a modifier map

To change modifier mappings run the following command in a scoterm window:

xmodmap -e expression

expression is a quoted string that tells xmodmap how to change the modifier map.

To add a keysym to a specific modifier, expression takes the following form:

"add modifier = keysym_name"

Modifiers can be attached to up to two keysyms. modifier is one of the following: shift, lock, control, mod1, mod2, mod3, mod4, or mod5. keysym_name is the name of a keysym to which you want to attach modifier. 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 also that this command does not override any existing modifier attachments; it only adds an attachment.


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

For example, if the shift modifier is only mapped to the left <Shift> key, you can attach the shift modifier to the right <Shift> key with the following command:

xmodmap -e "add shift = Shift_R"

To remove a keysym from a specific modifier, expression takes the following form:

"remove modifier = keysym_name"

modifier is one of the following: shift, lock, control, mod1, mod2, mod3, mod4, or mod5. keysym_name is the name of a keysym to which modifier is already attached. For example, to remove the shift modifier's attachment to the left <Shift> key, use the following command:

xmodmap -e "remove shift = Shift_L"

The above command does not affect the shift modifier's attachment to the right <Shift> key.

Modifiers are usually attached not only to keysyms but also to specific scancodes generated by the keyboard. Although you can change the keysyms to which a modifier is attached, you cannot change the keys to which modifiers are directly attached. If a modifier's attachment to a scancode prevents the modifier mapping you desire, you can clear all of the modifier's attachments with the following command:

xmodmap -e "clear modifier"

This command removes all of modifier's attachments to keysyms and keyboard scancodes. You can then attach the modifier to any desired keysyms. If you need to attach the modifier to a keyboard scancode, however, you must create a new .Xsco.cfg file with xsconfig(X).


NOTE: The modifier map listing generated by xmodmap -pm only shows the keysyms, not the keyboard scancodes, to which modifiers are attached. If you want to remap modifiers, be sure to determine which keys the modifiers are attached to by examining the /usr/lib/X11/xsconfig/default.kbd file or, if you are using a non-U.S. keyboard, the keyboard file from which the configuration file was compiled, /usr/lib/X11/xsconfig/mapkey.kbd. Note that the scancodes in default.kbd correspond to server keycodes minus 7.

xmodmap can also accept commands from a file or standard input.

See also:


Step 2: Examining the modifier map

To view the current modifier map, run the following command at the prompt in a scoterm window:

xmodmap -pm

A list of modifiers and the keysyms and keycodes to which they are attached appears. The following is an example modifier map listing:

   xmodmap:  up to 2 keys per modifier, (keycodes in parentheses):
   

shift Shift_L (0x31), Shift_R (0x3d) lock Caps_Lock (0x41) control Control_L (0x24), Control_R (0x87) mod1 Alt_L (0x3f), Alt_R (0x88) mod2 Num_Lock (0x4c) mod3 mod4 mod5

This listing indicates that the shift modifier is attached to the keysyms for both the left and right <Shift> keys.


Next topic: Changing the keymap table
Previous topic: About the server keyboard

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