dxkeycaps - Graphically display and edit the keyboard mapping
Run dxkeycaps with no command line options to edit the keyboard mapping of the keyboard that is attached to your workstation.
The dxkeycaps command accepts all of the standard toolkit options. It also accepts the following options: Specifies the type of keyboard to display. There are many different types of computer keyboards, and to function correctly dxkeycaps must know which one you are using. The following keyboards are known:
PCXAL (American) PCXAL (Dansk) PCXAL (Deutsch) PCXAL (Schweiz) PCXAL (British/Irish) PCXAL (Espanol) PCXAL (Francais) PCXAL (Canadien) PCXAL (SuisseRomande) PCXAL (Italiano) PCXAL (Nederlands) PCXAL (Norsk) PCXAL (Portugues) PCXAL (Suomi) PCXAL (Svenska) PCXAL (Vlaams)
NCD N101 NCD N102 NCD N102sf NCD N108 NCD N97 NCD vt220
The dxkeycaps command displays a keyboard with keycaps drawn according to the current server keymap. When you move the mouse over a key, the command describes the key symbols and modifiers that the key generates. Clicking MB1 on a key simulates pressing a key. Clicking MB3 on a key brings up a menu of operations, including a command to change the key symbol that the key generates.
This program is, in part, a graphical front-end to
The bottom part of the window is a drawing of a keyboard. In the top left of each key is printed the string which actually appears on the surface of the key. In the bottom right of the key is the (hexadecimal) keycode that this key generates.
At the top of the screen are several lines of text describing the key
under the mouse (or the most recently typed key.) These lines are:
Displays the text printed on the physical key, and the keycode
generated by that key in hex, decimal, and octal.
Displays the set of Key symbols that this key currently generates.
Displays the modifier bits that this key generates. If a
key generates modifiers, it is a chord-key like
States whether the X server claims that this key autorepeats.
The Commands pull-down menu in the upper left corner of the window contains the menu items Keyboard, Reset to Default, Save, and Exit: Brings up a menu from which you can change which keyboard is displayed. For machines with PC class keyboards, this menu offers the options of
You can arrange for these bindings to be installed each time you log in by placing an xmodmap command in your .X11Startup file. For example:
If you place an xmodmap command in your .X11Startup file, be sure that the file is loaded by the Session Manager, dxsession. See dxsession(1X) for information about Session Manager and the .X11Startup file.
Typing a key on the real keyboard simulates a KeyPress/KeyRelease event pair in the same way that clicking on a key does.
You can also combine mouse and keyboard input: for example, if you use the mouse to select the Shift key, and type a character, the event that is simulated will have the Shift modifier set. And if you hold down the real Control key, and click on the C key in the window, a Control-C event will be generated. (Assuming that your window manager does not intercept control-left-button for its own purposes.)
Clicking MB3 on a key pops up a menu of commands for the given key. They are: This pops up the ``Edit Key'' window, which allows you to arbitrarily change which key symbols and modifiers this key generates.
The dxkeycaps command understands all of the core resource names and classes as well as: Which keyboard to display; this is the same as the -keyboard command-line option. If this is not specified, the default keyboard is guessed, based on the server's vendor identification string. dxkeycaps can distinguish between the LK and PC class keyboards, and will not allow displaying or editing the LK keyboard on a workstation that has a PC keyboard (or vice-versa). The color to use to highlight a key when it is depressed. If this is the same as the background color of the key, it is highlighted with a stipple pattern instead. The color to paint the keycap string. The color to paint the keycode number. The color of the box around each key. The font to use to draw the keycap string. The font to use to draw the keycode number. The thickness of the box around each key. How many pixels to leave between this key and its neighbors to the right and bottom.
The class of each key widget is
in the previous list. The name of each key is the string(s) printed on its
face. For example, if you wanted the
keys to have
wider borders, you could specify:
It is possible to rebind the actions that happen when you press or release a key or mouse button. These actions are available on the Keyboard widget: This places the key in question in the highlighted state.
The default actions for the Keyboard widget are:
<Motion>: DescribeKey(mouse,unlessTracking) \n\
<KeyDown>: HighlightKey() \
SimulateKeyPress() \n\ \ <KeyUp>: UnhighlightKey() \
SimulateKeyRelease() \n\ \ <Btn1Down>: HighlightKey(unlessMod) \
SimulateKeyRelease(unlessHighlighted) \n\ \ <Btn1Up>: UntrackKey(highlighted) \
UnhighlightKey(highlighted,unlessMod) \n\ \ <Btn3Down>: XawPositionSimpleMenu(keyMenu) \
If you do not want a key to be described each time the mouse moves over it, you can remove the <Motion> action. In that case, you should probably add DescribeKey() to the <Btn1Down> and <KeyDown> actions.
If you want the key under the mouse to be described even while the mouse is moving with a button down, then remove the unlessTracking parameter from the DescribeKey action bound to <Motion>.
If you do not want the modifier keys to toggle, change the Button1 actions to the following:
DXkeycaps*Keyboard.actions: #override \
<Btn1Down>: HighlightKey() \
<Btn1Up>: UntrackKey(highlighted) \
Remember that these actions exist on the
widget, not on the
widgets. If you add actions
widgets, things will malfunction.
The following description is from the X Protocol document, and is reprinted here for your convenience:
A list of KeySyms is associated with each KeyCode. If that list (ignoring trailing NoSymbol entries) is a single KeySym "K", then the list is treated as if it were the list "K NoSymbol K NoSymbol". If the list (ignoring trailing NoSymbol entries) is a pair of KeySyms "K1 K2", then the list is treated as if it were the list "K1 K2 K1 K2". If the list (ignoring trailing NoSymbol entries) is a triple of KeySyms "K1 K2 K3", then the list is treated as if it were the list "K1 K2 K3 NoSymbol".
The first four elements of the list are split into two groups of KeySyms. Group 1 contains the first and second KeySyms, Group 2 contains third and fourth KeySyms. Within each group, if the second element of the group is NoSymbol, then the group should be treated as if the second element were the same as the first element, except when the first element is an alphabetic KeySym K for which both lowercase and uppercase forms are defined. In that case, the group should be treated as if the first element were the lowercase form of "K" and the second element were the uppercase form of "K".
The standard rules for obtaining a KeySym from a KeyPress event make use of only the Group 1 and Group 2 KeySyms; no interpretation of other KeySyms in the list is given here. (That is, the last four KeySyms are unused.)
Which group to use is determined by modifier state. Switching between groups is controlled by the KeySym named Mode_switch.
By attaching that KeySym to some KeyCode and attaching that KeyCode to any one of the modifiers Mod1 through Mod5. This modifier is called the ``group modifier.'' For any KeyCode, Group 1 is used when the group modifier is off, and Group 2 is used when the group modifier is on.
Within a group, which
to use is also determined
by modifier state. The first
is used when the
modifiers are off. The second
is used when the
modifier is on,
or when the
modifier is on and the second
is uppercase alphabetic, or when the
modifier is on and is interpreted as
modifier is on and is interpreted as
CapsLock, the state of the
applied first to select a
KeySym, but if that
is lowercase alphabetic, then the corresponding uppercase
is used instead.
The following description is from the InterClient Communications Conventions Manual:
X11 supports eight modifier bits, three of which are pre-assigned to Shift, Lock and Control. Each modifier bit is controlled by the state of a set of keys, and these sets are specified in a table accessed by GetModifierMapping() and SetModifierMapping().
A client needing to use one of the pre-assigned modifiers should assume that the modifier table has been set up correctly to control these modifiers. The Lock modifier should be interpreted as Caps Lock or Shift Lock according as the keycodes in its controlling set include XK_Caps_Lock or XK_Shift_Lock.
Clients should determine the meaning of a modifier bit from the keysyms being used to control it.
A client needing to use an extra modifier, for example Meta, should:
Scan the existing modifier mappings. If it finds a modifier that contains a keycode whose set of keysyms includes XK_Meta_L or XK_Meta_R, it should use that modifier bit.
If there is no existing modifier controlled by XK_Meta_L or XK_Meta_R, it should select an unused modifier bit (one with an empty controlling set) and:
If there is a keycode with XL_Meta_L in its set of keysyms, add that keycode to the set for the chosen modifier, then
if there is a keycode with XL_Meta_R in its set of keysyms, add that keycode to the set for the chosen modifier, then
if the controlling set is still empty, interact with the user to select one or more keys to be Meta.
If there are no unused modifier bits, ask the user to take corrective action.
This means that the Mod1 modifier does not necessarily mean Meta, although some applications (such as twm and emacs) assume that. Any of the five unassigned modifier bits could mean Meta; what matters is that a modifier bit is generated by a keycode which is bound to the keysym Meta_L or Meta-R.
Therefore, if you want to make a ``meta'' key, the best way
is to make the keycode in question generate both a
keysym, and a modifier bit.
Because this program has default colors that are not ``black and
command-line option does not work.
But the following incantation does what you want on a monochrome screen:
% dxkeycaps -fg white -bg black -bd white
Use this environment variable to get the default host and
Use this environment variable to get the name of a resource
file that overrides the global resources stored in the RESOURCE_MANAGER property.
X(1X), xmodmap(1X), dxsession(1X)