table of contents
XKeyCaps(1) | General Commands Manual | XKeyCaps(1) |
NAME¶
xkeycaps - graphically display and edit the X keyboard mappingSYNOPSIS¶
xkeycaps [- toolkitoption ...] [-option ...]DESCRIPTION¶
The xkeycaps program displays a keyboard. Moving the mouse over a key describes the keysyms and modifiers that that key generates. Clicking left on a key simulates a KeyPress event. Clicking right on a key brings up a menu of operations, including a command to change the keysyms that the key generates. This program is, in part, a graphical front-end to xmodmap(1).OPTIONS¶
xkeycaps accepts all of the standard toolkit options, and also accepts the following options:- -keyboard keyboard-name or -kbd keyboard-name
- Specifies the type of keyboard to display. There are many
different computer keyboards in the world, and xkeycaps must know
which one you are using in order to function correctly. Case does not
matter when specifying a keyboard name.
- -help
- Lists the recognized values for the -keyboard option.
- -gutterwidth number or -gw number
- Specifies the number of pixels of space to leave between each key.
- -font fontname
- Specifies the font to use to display the keycaps.
¶
The following standard X Toolkit command line arguments are commonly used with xkeycaps:- -display host:dpy
- This option specifies the X server to contact.
- -geometry geometry
- This option specifies the preferred size and position of the window.
- -bg color
- This option specifies the color to use for the background of the window. The default is light gray.
- -fg color
- This option specifies the color to use for the foreground of the window. The default is black.
- -bw number
- This option specifies the width in pixels of the border surrounding the window.
- -xrm resourcestring
- This option specifies a resource string to be used. This is especially useful for setting resources that do not have separate command line options.
DISPLAY¶
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.- KeyCode:
- This displays the text printed on the physical key, and the keycode generated by that key in hex, decimal, and octal.
- KeySym:
- This displays the set of KeySyms that this key currently generates.
- ASCII:
- This displays the ASCII equivalent of this key, taking into account the current modifier keys which are down.
- Modifiers:
- this displays the modifier bits which this key generates. If a key generates modifiers, it is a chord-key like Shift or Control.
- AutoRepeat:
- Whether the X server claims that this key autorepeats. I say `` claims'' because the OpenWindows X server is the only one I have encountered for which this information is accurate. The per-key autorepeat flag seems to be almost-universally ignored.
COMMANDS¶
There are several buttons in the upper left corner of the window. They are:- Quit
- Exits the program.
- Select Keyboard
- Pops up a dialog box from which you can change which keyboard is displayed. The left column lists the known types of keyboards, and the right column lists the known layouts (mappings) of those keyboards.
- Type At Window
- After selecting this, you are asked to click on some other
window. After doing this, clicking on keys on the keyboard display will
simulate key events on the window you selected. Selecting the root window
or the xkeycaps window turns this off.
- Restore Default Map
- This command restores the keyboard to its default state. If you execute this command while displaying a keyboard which is not the type of keyboard you are really using, your keymap will be in a nonsensical state. There is no way for xkeycaps to tell what keyboard you are using except by taking your word for it, so don't lie.
- Write Output
- This command writes an xmodmap input file
representing the current state of the keyboard (including all of your
changes) to a file in your home directory. Note that this command DOES NOT
write out the default keymap for this keyboard type unless you have
clicked on Restore Default Map before.
xmodmap /.xmodmap-`uname -n`
in the appropriate init file, so that those keyboard modifications are made each time you log in. (If you're not sure where this command should go, ask your system administrator, as that tends to vary from site to site.)
- Exchange Keys
- After selecting this menu item, you are asked to click on another key. That key and the key on which you brought up the menu will be exchanged. This changes the keyboard mapping immediately.
- Duplicate Key
- After selecting this menu item, you are asked to click on another key. That key will be made a copy of the key on which you brought up the menu. That is, the two keys will generate the same set of keysyms and modifiers. This changes the keyboard mapping immediately.
- Disable Key
- The key on which you brought up the menu will be made to generate no keysyms and no modifiers. This changes the keyboard mapping immediately.
- Restore Key To Default
- The key on which you brought up the menu will be restored to its default state; no other key will be altered. This actually changes the current keyboard mapping.
- Edit KeySyms of Key
- This pops up the "Edit Key" window, which allows
you to arbitrarily change which keysyms and modifiers this key generates.
KEYSYMS AND KEYCODES¶
To effectively edit your keyboard mapping, there are some terms you need to be familiar with:- KeyCode
- This is a raw scan-code that is read from the keyboard;
each physical key on the keyboard has a different number associated with
it; this mapping cannot be changed (but that's ok.)
- KeySym
- This is a symbol which can be generated by a single press
of one key on the keyboard: for example, all letters, numbers, and
punctuation are keysyms, and so are more abstract things like ``shift''
and ``control''.
- KeyCap
- Not to be confused with KeySyms, this refers to the text which is printed on the physical keys: it is immutable (unless you repaint your keyboard...)
- Chord
- This term refers to a set of two or more keys held down simultaneously (by analogy with piano keyboards.) All but one of the keys will generally be Modifier Keys. Sometimes Constellation is used to mean the same thing.
- Modifier Key
- This is a key like shift or control, which is used to alter
the interpretation of other keys which are held down at the same time.
Generally, pressing a modifier key without also pressing a non-modifier
key does nothing.
- Modifier KeySym
- A KeySym is a modifier keysym if it has a Modifier Bit
associated with it. But, the rules are a little more complicated than
that. It's easier to describe by example:
- Modifier Bit
- Modifier bits are attributes which certain keysyms can
have. Some modifier bits have predefined semantics: Shift, Lock, and
Control. The remaining modifier bits (Mod1 through Mod5) have semantics
which are defined by the keys with which they are associated.
X PROTOCOL DOCUMENT ON KEYMAPS¶
The following is a more precise technical explanation of how keymapping works. This 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 KeySym to use is also determined by modifier state. The
first KeySym is used when the Shift and Lock modifiers are off.
The second KeySym is used when the Shift modifier is on, or when the
Lock modifier is on and the second KeySym is uppercase alphabetic, or
when the Lock modifier is on and is interpreted as ShiftLock.
Otherwise, when the Lock modifier is on and is interpreted as
CapsLock, the state of the Shift modifier is applied first to
select a KeySym, but if that KeySym is lowercase alphabetic, then the
corresponding uppercase KeySym is used instead.
ICCCM ON THE MODIFIER MAPPING¶
The following is a more precise technical explanation of how modifier keys are interpreted. This description is from the Inter-Client Communications Conventions Manual, and is reprinted here for your convenience:X11 supports 8 modifier bits, of which 3 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.
THE MODE_SWITCH KEYSYM¶
In case the above didn't make sense, what the Mode_switch keysym does is, basically, act as an additional kind of shift key. If you have four keysyms attached to the A key, then those four keysyms will be accessed by the chords: A; Shift-A, Mode_Switch-A; and Mode_Switch-Shift-A, respectively.THE MULTI_KEY KEYSYM¶
Not to be confused with Mode_switch, Multi_key allows the input of multiple character sequences that represent a single character (keysym.) A more traditional name for this keysym might have been Compose.DEAD KEYSYMS¶
Dead keys work similarly Multi_key, but they are two-keystroke commands instead of three. For example, pressing the Dead_tilde key, releasing it, then pressing the A key would generate the single keysym Atilde. (They are called ``dead'' keys because they do not, by themselves, insert characters, but instead modify the following character typed. But HP likes to call them ``mute'' instead of ``dead,'' no doubt to avoid frightening the children.)THINGS YOU CAN'T DO¶
People often ask if xkeycaps or xmodmap can be used to make one key generate a sequence of characters. Unfortunately, no: you can't do this sort of thing by manipulating the server's keymaps. The X keyboard model just doesn't work that way.xterm*VT100.Translations: #override \ <Key>F17: string("next")Other applications may have different mechanisms for accomplishing the same thing, and some applications might not support it at all. Check the relevant man pages for specifics.
LOSER VENDORS¶
Both HP and S.u.S.E. ship their systems with broken keyboard settings by default. They really should know better, but they don't.X RESOURCES¶
XKeyCaps understands all of the core resource names and classes as well as:- *Keyboard.keyboard (class Keyboard)
- 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.
- *Keyboard.Keyboard.selectCursor (class Cursor)
- The cursor to use when selecting a key or window with the mouse. The default is the crosshair cursor.
- *Keyboard.Key.highlight (class Background)
- 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.
- *Keyboard.Key.keycapColor (class Foreground)
- The color to paint the keycap string.
- *Keyboard.Key.keycodeColor (class Foreground)
- The color to paint the keycode number.
- *Keyboard.Key.borderColor (class Color)
- The color of the box around each key.
- *Keyboard.Key.keycapFont (class Font)
- The font to use to draw the keycap string.
- *Keyboard.Key.keycodeFont (class Font)
- The font to use to draw the keycode number.
- *Keyboard.Key.borderWidth (class Int)
- The thickness of the box around each key.
- *Keyboard.Key.gutterWidth (class Int)
- How many pixels to leave between this key and it's neighbors to the right and bottom.
xkeycaps*Keyboard.Shift.borderWidth: 2
ACTIONS¶
It is possible to rebind the actions which happen when a key or mouse button is pressed or released. These actions are available on the Keyboard widget:- HighlightKey(condition, arg)
- This places the key in question in the highlighted state.
- UnhighlightKey(condition, arg)
- This places the key in question in the unhighlighted state. Arguments are as above.
- ToggleKey(condition, arg)
- This makes the key be highlighted if it is unhighlighted, or unhighlighted if it is highlighted. Arguments are as above.
- SimulateKeyPress(condition, arg)
- This action makes a KeyPress event corresponding to the key be synthesized on the focus window. Arguments are as above.
- SimulateKeyRelease(condition, arg)
- This action makes a KeyRelease event corresponding to the key be synthesized on the focus window. Arguments are as above.
- TrackKey(condition, arg)
- This makes the key in question begin being ``tracked'', which means that moving the mouse off of it will simulate a button-release action, and then will simulate a button-press action on the key that the mouse has moved on to. This action may only be invoked from a ButtonPress or ButtonRelease event.
- UntrackKey(condition, arg)
- This makes the key in question no longer be ``tracked.''
- DescribeKey(condition, arg)
- This action causes the key and its bindings to be displayed in the ``Info'' section at the top of the window, if it is not already described there.
<Motion>: DescribeKey(mouse,unlessTracking) \n\ \ <KeyDown>: HighlightKey() \ DescribeKey(unlessMod) \ DescribeKey(displayed) \ SimulateKeyPress() \n\ \ <KeyUp>: UnhighlightKey() \ DescribeKey(displayed) \ SimulateKeyRelease() \n\ \ <Btn1Down>: HighlightKey(unlessMod) \ ToggleKey(ifMod) \ TrackKey(unlessMod) \ SimulateKeyPress(ifHighlighted) \ SimulateKeyRelease(unlessHighlighted) \n\ \ <Btn1Up>: UntrackKey(highlighted) \ SimulateKeyRelease(highlighted,unlessMod) \ UnhighlightKey(highlighted,unlessMod) \n\ \ <Btn3Down>: XawPositionSimpleMenu(keyMenu) \ MenuPopup(keyMenu) \nIf you don't 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.
xkeycaps*Keyboard.actions: #override \ <Btn1Down>: HighlightKey() \ TrackKey(unlessmod) \ SimulateKeyPress() \n\ <Btn1Up>: UntrackKey(highlighted) \ SimulateKeyRelease(highlighted) \ UnhighlightKey(highlighted) \nRemember that these actions exist on the Keyboard widget, not on the Key widgets. If you add actions to the Key widgets, things will malfunction.
ENVIRONMENT¶
- DISPLAY
- to get the default host and display number.
- XENVIRONMENT
- to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property.
- XKEYSYMDB
- to get the location of the XKeysymDB file, which lists the vendor-specific keysyms.
UPGRADES¶
The latest version can always be found at http://ftp.debian.org/debian/pool/main/x/xkeycaps/SEE ALSO¶
X(1), xmodmap(1), xset(1), xdpyinfo(1)BUGS¶
Because this program has default colors that aren't "black" and "white", the -rv command-line option doesn't work. But the incantation% xkeycaps -fg white -bg black -bd whitewill do what you want on a monochrome screen.
COPYRIGHT¶
Copyright © 1991-1999 by Jamie Zawinski. Copyright © 2005-2006 by Christoph Berg. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. No representations are made about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.AUTHOR¶
Jamie Zawinski <jwz@jwz.org>, 10-nov-91.- Thanks to:
- Jonathan Abbey, Alon Albert, Vladimir Alexiev, David Arnold, David Axmark, Ruediger Back, Pedro Bayon, Corne Beerse, Eric Benson, Christoph Berg, Markus Berndt, Roger Binns, Stefan Bjornelund, black@westford.ccur.com, Mark Borges, Volker Bosch, Dave Brooks, Lorenzo M. Catucci, Michel Catudal, Francois Regis Colin, John Coppens, Cesar Crusius, Bart Van Cutsem, Matthew Davey, Christopher Davis, Albrecht Dress, Kristian Ejvind, Michael Elbel, Joe English, Eric Fischer, Morgan Fletcher, Olivier Galibert, Carson Gaspar, Andre Gerhard, Daniel Glastonbury, Christian F. Goetze, Dan R. Greening, Edgar Greuter, John Gotts, Berthold Gunreben, Jens Hafsteinsson, Adam Hamilton, Magnus Hammerin, Kenneth Harker, Ben Harris, Mikael Hedin, Tom Ivar Helbekkmo, Mick Hellstrom, Neil Hendin, Andre Heynatz, Mike Hicks, Alan Ho, Hide Horiuchi, Dirk Jablonowski, Alan Jaffray, Anders Wegge Jakobsen, Chris Jones, Jorgen Jonsson, Peter Kaiser, Heikki Kantola, Tufan Karadere, Benedikt Kessler, Philippe Kipfer, Edwin Klement, John Knox, Haavard Kvaalen, Frederic Leguern, Simon Leinen, Michael Lemke, Tor Lillqvist, Torbjorn Lindgren, Tony Lindstrom, Richard Lloyd, Ulric Longyear, Ulf Magnusson, Cliff Marcellus, John A. Martin, Tom McConnell, Grant McDorman, Hein Meling, Jason Merrill, Aleksandar Milivojevic, Manuel Moreno, Ken Nakata, Pekka Nikander, Todd Nix, Leif Nixon, Christian Nybo, Antoni Pamies Olive, Edgar Bonet Orozco, Steven W. Orr, Martin Ouwehand, Daniel Packman, John Palmieri, Chris Paulson-Ellis, Antony Pavloff, Eduardo Perez, Michael Piotrowski, Andrej Presern, Jeremy Prior, Dominique Quatravaux, Matthias Rabe, Garst R. Reese, Peter Remmers, Todd Richmond, Ken Rose, Pavel Rosendorf, Gael Roualland, Lucien Saviot, Johannes Schmidt-Fischer, Andreas Schuch, Larry Schwimmer, Joe Siegrist, Jarrod Smith, Tom Spindler, Robin Stephenson, Joerg Stippa, D. Stolte, A. A. Stoorvogel, Juergen Stuber, Markus Stumpf, Jeffrey Templon, Jay Thorne, Anthony Thyssen, Christoph Tietz, tkil@scrye.com, Juha Vainikka, Poonlap Veeratanabutr, Ivo Vollrath, Gord Vreugdenhil, Ronan Waide, Jan Wedekind, Bjorn Wennberg, Mats Wichmann, Stephen Williams, Barry Warsaw, Steven Winikoff, Carl Witty, Stephen Wray, Endre Witzoe, Kazutaka Yokota, Yair Zadik, and Robert Zwickenpflug.
02-Jan-06 | XKeyCaps 2.47 |