xmodmap(1X) xmodmap(1X)NAME xmodmap - modifies keyboard modifier maps SYNOPSIS xmodmap [-display display] [-help] [-grammar] [-verbose] [-quiet] [-n] [-e expression]... [-pk] [-pm] [-pp] [-] [file] DESCRIPTION xmodmap displays and alters the X keyboard modifier map and keysym table on the specified display and host. It is in- tended to be run from your X startup script to set up the keyboard according to personal tastes. You can also use xmodmap to print the current pointer map on the standard output. With no arguments, xmodmap displays the current map. Options The xmodmap command accepts these options: -display display Specifies the host and display to use. See X(1X) for details. -e expression Specifies an expression to be executed. You can specify any number of expressions from the command line. -help Displays a summary of the command syntax. Any un- supported option also causes xmodmap to display this summary. -grammar Displays a message that describes the expression grammar that xmodmap expects to find in files and in expressions passed using the -e option. -n Indicates that xmodmap should not change the map- pings, but should display what it would do. This op- tion is analogous to the -n option to make(1). -pm Causes xmodmap to print the current modifier map on the standard output. -pk Causes xmodmap to print the current keysym table on the standard output. -pp Causes xmodmap to print the current pointer map on the standard output. November, 1990 1
xmodmap(1X) xmodmap(1X)-quiet Turns off the verbose logging. This is the default. -verbose Causes xmodmap to print logging information as it parses its input. - Causes xmodmap to use the standard input as the in- put file. The file specified by file contains expressions for xmodmap to execute. This file is usually kept in your home directo- ry with a name such as .xmodmaprc. Expression grammar The xmodmap command reads a list of expressions and parses them all before attempting to execute any of them. This makes it possible to refer to keysyms that are being rede- fined without having to worry excessively about name con- flicts. Allowable expressions include the following: add modifier=keysym... Adds the given keysyms to the indicated modifier map. The keysym names are evaluated after all input expressions are read to make it easy to write ex- pressions to swap keys. See the ``Examples'' section later in this manual page. clear modifier Removes all entries in the modifier map for the given modifier, where valid names are: Shift, Lock, Control, Mod1, Mod2, Mod3, Mod4, and Mod5. Case does not matter in modifier names, although it does matter for all other names. For example, clear Lock removes any keys that were bound to the CAPS LOCK modifier. keycode number=keysym... Assigns the list of keysyms to the indicated key- code, which may be specified in decimal, hexade- cimal, or octal and can be determined by running xev(1X) in the client directory. Usually only one keysym is assigned to a given code. keysym keysym=keysym... Looks up keysym on the left side of the equal sign (=) to find its current keycode and replaces the line with the appropriate keycode expression. Note that if you have the same keysym bound to multiple keys, this might not work. pointer = default Sets the pointer map back to its default settings, 2 November, 1990
xmodmap(1X) xmodmap(1X)where the mouse button generates a code of 1, the LEFT ARROW key generates a code of 2, and the RIGHT ARROW key generates a code of 3. pointer = number Sets the pointer map to contain the indicated button codes that correspond to the buttons on a three- button mouse. The list always starts with the first physical button. remove modifier=keysym... Removes the given keysyms from the indicated modif- ier map. Unlike add, the keysym names are evaluated as the line is read in. This allows you to remove keys from a modifier without having to worry about whether they have been reassigned. Lines that begin with an exclamation mark (!) are taken as comments. If you want to change the binding of a modifier key, you must also remove it from the appropriate modifier map. Environment variables The xmodmap command uses the following environment variable: DISPLAY Specifies the default host, display number, and screen. EXAMPLES To make the BACK SPACE key delete the character beneath the pointer instead of moving the pointer backward, use xmodmap -e "keysym BackSpace = Delete" To swap the functions of the left CONTROL and CAPS LOCK keys, you could use: ! ! Swap Caps_Lock and Control_L ! remove Lock = Caps_Lock remove Control = Control_L keysym Control_L = Caps_Lock keysym Caps_Lock = Control_L add Lock = Caps_Lock add Control = Control_L The following is a more sophisticated example: ! November, 1990 3
xmodmap(1X) xmodmap(1X)! On the HP, the following keycodes have ! the corresponding character keys: ! ! 101 Backspace ! 55 Caps ! 14 Ctrl ! 15 Break/Reset ! 86 Stop ! 89 F5 ! ! I prefer using ``keycode'' over ! ``keysym'' so that I can rerun the ! file to fix up my keyboard. ! ! This example causes the BACK SPACE key to ! function as a DELETE key, the CAPS LOCK ! key to function as a CONTROL key, the F5 ! key to function as an ESCAPE key, and the ! BREAK/RESET key to function as a SHIFT LOCK ! key. Also, all keys bound to the ! CAPS LOCK modifier are removed. keycode 101 = Delete keycode 55 = Control_R clear Lock add Control = Control_R keycode 89 = Escape keycode 15 = Caps_Lock add Lock = Caps_Lock NOTES Copyright 1988, Massachusetts Institute of Technology. Copyright 1987, Sun Microsystems, Inc. See X(1X) for a full statement of rights and permissions. Authors: Jim Fulton, MIT X Consortium, original version by David Rosenthal, Sun Microsystems LIMITATIONS Every time a keycode expression is evaluated, the server generates a MappingNotify event on every client. This can cause some thrashing. All changes should be batched togeth- er and done at once. Clients that receive keyboard input and ignore these events do not notice any changes made to keyboard mappings. The xmodmap command should generate add and remove expres- sions automatically whenever a keycode that is already bound to a modifier is changed. 4 November, 1990
xmodmap(1X) xmodmap(1X)There should be a way to have the remove expression accept keycodes as well as keysyms. SEE ALSO X(1X) November, 1990 5