481 lines
12 KiB
HTML
481 lines
12 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of XMODMAP</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>XMODMAP</H1>
|
|
Section: User Commands (1)<BR>Updated: xmodmap 1.0.9<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
xmodmap - utility for modifying keymaps and pointer button mappings in X
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>xmodmap</B>
|
|
|
|
[-options ...] [filename]
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
|
|
The <I>xmodmap</I> program is used to edit and display the
|
|
keyboard <I>modifier map</I> and <I>keymap table</I> that are used by client
|
|
applications to convert event keycodes into keysyms. It is usually run from
|
|
the user's session startup script to configure the keyboard according to
|
|
personal tastes.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<P>
|
|
|
|
The following options may be used with <I>xmodmap</I>:
|
|
<DL COMPACT>
|
|
<DT id="1"><B>-display </B><I>display</I>
|
|
|
|
<DD>
|
|
This option specifies the host and display to use.
|
|
<DT id="2"><B>-help</B>
|
|
|
|
<DD>
|
|
This option indicates that a brief description of the command line arguments
|
|
should be printed on the standard error channel. This will be done whenever an
|
|
unhandled argument is given to
|
|
<I>xmodmap.</I>
|
|
|
|
<DT id="3"><B>-grammar</B>
|
|
|
|
<DD>
|
|
This option indicates that a help message describing the expression grammar
|
|
used in files and with -e expressions should be printed on the standard error.
|
|
<DT id="4"><B>-version</B>
|
|
|
|
<DD>
|
|
This option indicates that
|
|
<I>xmodmap</I>
|
|
|
|
should print its version information and exit.
|
|
<DT id="5"><B>-verbose</B>
|
|
|
|
<DD>
|
|
This option indicates that
|
|
<I>xmodmap</I>
|
|
|
|
should print logging information as it parses its input.
|
|
<DT id="6"><B>-quiet</B>
|
|
|
|
<DD>
|
|
This option turns off the verbose logging. This is the default.
|
|
<DT id="7"><B>-n</B>
|
|
|
|
<DD>
|
|
This option indicates that
|
|
<I>xmodmap</I>
|
|
|
|
should not change the mappings, but should display what it would do, like
|
|
<I><A HREF="/cgi-bin/man/man2html?1+make">make</A>(1)</I> does when given this option.
|
|
<DT id="8"><B>-e </B><I>expression</I><B></B>
|
|
|
|
<DD>
|
|
This option specifies an expression to be executed. Any number of expressions
|
|
may be specified from the command line.
|
|
<DT id="9"><B>-pm</B>
|
|
|
|
<DD>
|
|
This option indicates that the current modifier map should be printed on the
|
|
standard output. This is the default mode of operation if no other mode
|
|
options are specified.
|
|
<DT id="10"><B>-pk</B>
|
|
|
|
<DD>
|
|
This option indicates that the current keymap table should be printed on the
|
|
standard output.
|
|
<DT id="11"><B>-pke</B>
|
|
|
|
<DD>
|
|
This option indicates that the current keymap table should be printed on the
|
|
standard output in the form of expressions that can be fed back to
|
|
<I>xmodmap</I>.
|
|
<DT id="12"><B>-pp</B>
|
|
|
|
<DD>
|
|
This option indicates that the current pointer map should be printed on the
|
|
standard output.
|
|
<DT id="13"><B>-</B>
|
|
|
|
<DD>
|
|
A lone dash means that the standard input should be used as the input file.
|
|
</DL>
|
|
<P>
|
|
|
|
The <I>filename</I> specifies a file containing <I>xmodmap</I> expressions
|
|
to be executed. This file is usually kept in the user's home directory with
|
|
a name like <I>.xmodmaprc</I>.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>EXPRESSION GRAMMAR</H2>
|
|
|
|
<P>
|
|
|
|
The
|
|
<I>xmodmap</I>
|
|
|
|
program 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 redefined in a natural way without having to worry as much about name
|
|
conflicts.
|
|
<P>
|
|
|
|
The list of keysym names may be found in the header file
|
|
<I><<A HREF="file:///usr/include/X11/keysymdef.h">X11/keysymdef.h</A>></I> (without the <I>XK_</I> prefix),
|
|
supplemented by the keysym database <I> /usr/share/X11/XKeysymDB</I>.
|
|
Keysyms matching Unicode characters may be specified as "U0020" to "U007E"
|
|
and "U00A0" to "U10FFFF" for all possible Unicode characters.
|
|
<DL COMPACT>
|
|
<DT id="14"><B>keycode </B><I>NUMBER</I> = <I>KEYSYMNAME ...</I>
|
|
|
|
<DD>
|
|
The list of keysyms is assigned to the indicated keycode
|
|
(which may be specified in decimal, hex or octal and can be determined by
|
|
running the
|
|
<I>xev</I>
|
|
|
|
program). Up to eight keysyms may be attached to a key, however the last four
|
|
are not used in any major X server implementation. The first keysym is used
|
|
when no modifier key is pressed in conjunction with this key, the second with
|
|
Shift, the third when the Mode_switch key is used with this key and the fourth
|
|
when both the Mode_switch and Shift keys are used.
|
|
<DT id="15"><B>keycode any = </B><I>KEYSYMNAME ...</I>
|
|
|
|
<DD>
|
|
If no existing key has the specified list of keysyms assigned to it,
|
|
a spare key on the keyboard is selected and the keysyms are assigned to it.
|
|
The list of keysyms may be specified in decimal, hex or octal.
|
|
<DT id="16"><B>keysym </B><I>KEYSYMNAME</I> = <I>KEYSYMNAME ...</I>
|
|
|
|
<DD>
|
|
The <I>KEYSYMNAME</I> on the left hand side is translated into matching keycodes
|
|
used to perform the corresponding set of <B>keycode</B> expressions. Note that
|
|
if the same keysym is bound to multiple keys, the expression is executed
|
|
for each matching keycode.
|
|
<DT id="17"><B>clear </B><I>MODIFIERNAME</I>
|
|
|
|
<DD>
|
|
This removes all entries in the modifier map for the given modifier, where
|
|
valid name are:
|
|
<B>Shift</B>,
|
|
|
|
<B>Lock</B>,
|
|
|
|
<B>Control</B>,
|
|
|
|
<B>Mod1</B>,
|
|
|
|
<B>Mod2</B>,
|
|
|
|
<B>Mod3</B>,
|
|
|
|
<B>Mod4</B>,
|
|
|
|
and <B>Mod5</B> (case
|
|
does not matter in modifier names, although it does matter for all other
|
|
names). For example, ``clear Lock'' will remove
|
|
all any keys that were bound to the shift lock modifier.
|
|
<DT id="18"><B>add </B><I>MODIFIERNAME</I> = <I>KEYSYMNAME ...</I>
|
|
|
|
<DD>
|
|
This adds all keys containing 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
|
|
expressions to swap keys (see the EXAMPLES section).
|
|
<DT id="19"><B>remove </B><I>MODIFIERNAME</I> = <I>KEYSYMNAME ...</I>
|
|
|
|
<DD>
|
|
This removes all keys containing the given keysyms from the indicated
|
|
modifier map. Unlike
|
|
<B>add,</B>
|
|
|
|
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 or not they
|
|
have been reassigned.
|
|
<DT id="20"><B>pointer = default</B>
|
|
|
|
<DD>
|
|
This sets the pointer map back to its default settings (button 1 generates a
|
|
code of 1, button 2 generates a 2, etc.).
|
|
<DT id="21"><B>pointer = </B><I>NUMBER ...</I>
|
|
|
|
<DD>
|
|
This sets the pointer map to contain the indicated button codes. The list
|
|
always starts with the first physical button. Setting a button code to 0
|
|
disables events from that button.
|
|
</DL>
|
|
<P>
|
|
|
|
Lines that begin with an exclamation point (!) are taken as comments.
|
|
<P>
|
|
|
|
If you want to change the binding of a modifier key, you must also remove it
|
|
from the appropriate modifier map.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>EXAMPLES</H2>
|
|
|
|
<P>
|
|
|
|
Many pointers are designed such that the first button is pressed using the
|
|
index finger of the right hand. People who are left-handed frequently find
|
|
that it is more comfortable to reverse the button codes that get generated
|
|
so that the primary button is pressed using the index finger of the left hand.
|
|
This could be done on a 3 button pointer as follows:
|
|
|
|
|
|
<P>
|
|
|
|
|
|
<PRE>
|
|
% xmodmap -e "pointer = 3 2 1"
|
|
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Many applications support the notion of Meta keys (similar to Control
|
|
keys except that Meta is held down instead of Control). However,
|
|
some servers do not have a Meta keysym in the default keymap table, so one
|
|
needs to be added by hand.
|
|
The following command will attach Meta to the Multi-language key (sometimes
|
|
labeled Compose Character). It also takes advantage of the fact that
|
|
applications that need a Meta key simply need to get the keycode and don't
|
|
require the keysym to be in the first column of the keymap table. This
|
|
means that applications that are looking for a Multi_key (including the
|
|
default modifier map) won't notice any change.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
<PRE>
|
|
% xmodmap -e "keysym Multi_key = Multi_key Meta_L"
|
|
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Similarly, some keyboards have an Alt key but no Meta key.
|
|
In that case the following may be useful:
|
|
|
|
|
|
<P>
|
|
|
|
|
|
<PRE>
|
|
% xmodmap -e "keysym Alt_L = Meta_L Alt_L"
|
|
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
<P>
|
|
|
|
One of the more simple, yet convenient, uses of <I>xmodmap</I> is to set the
|
|
keyboard's "rubout" key to generate an alternate keysym. This frequently
|
|
involves exchanging Backspace with Delete to be more comfortable to the user.
|
|
If the <I>ttyModes</I> resource in <I>xterm</I> is set as well, all terminal
|
|
emulator windows will use the same key for erasing characters:
|
|
|
|
|
|
<P>
|
|
|
|
|
|
<PRE>
|
|
% xmodmap -e "keysym BackSpace = Delete"
|
|
% echo "XTerm*ttyModes: erase ^?" | xrdb -merge
|
|
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Some keyboards do not automatically generate less than and greater than
|
|
characters when the comma and period keys are shifted. This can be remedied
|
|
with <I>xmodmap</I> by resetting the bindings for the comma and period with
|
|
the following scripts:
|
|
|
|
|
|
<P>
|
|
|
|
|
|
<PRE>
|
|
!
|
|
! make shift-, be < and shift-. be >
|
|
!
|
|
keysym comma = comma less
|
|
keysym period = period greater
|
|
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
<P>
|
|
|
|
One of the more irritating differences between keyboards is the location of the
|
|
Control and CapsLock keys. A common use of <I>xmodmap</I> is to swap these
|
|
two keys as follows:
|
|
|
|
|
|
<P>
|
|
|
|
|
|
<PRE>
|
|
!
|
|
! 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
|
|
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
<P>
|
|
|
|
This example can be run again to swap the keys back to their previous
|
|
assignments.
|
|
<P>
|
|
|
|
The <I>keycode</I> command is useful for assigning the same keysym to
|
|
multiple keycodes. Although unportable, it also makes it possible to write
|
|
scripts that can reset the keyboard to a known state. The following script
|
|
sets the backspace key to generate Delete (as shown above), flushes all
|
|
existing caps lock bindings, makes the CapsLock
|
|
key be a control key, make F5 generate Escape, and makes Break/Reset be a
|
|
shift lock.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
<PRE>
|
|
!
|
|
! On the HP, the following keycodes have key caps as listed:
|
|
!
|
|
! 101 Backspace
|
|
! 55 Caps
|
|
! 14 Ctrl
|
|
! 15 Break/Reset
|
|
! 86 Stop
|
|
! 89 F5
|
|
!
|
|
keycode 101 = Delete
|
|
keycode 55 = Control_R
|
|
clear Lock
|
|
add Control = Control_R
|
|
keycode 89 = Escape
|
|
keycode 15 = Caps_Lock
|
|
add Lock = Caps_Lock
|
|
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H2>ENVIRONMENT</H2>
|
|
|
|
<P>
|
|
|
|
<DL COMPACT>
|
|
<DT id="22"><B>DISPLAY</B>
|
|
|
|
<DD>
|
|
to get default host and display number.
|
|
</DL>
|
|
<A NAME="lbAI"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<A HREF="/cgi-bin/man/man2html?7+X">X</A>(7), <A HREF="/cgi-bin/man/man2html?1+xev">xev</A>(1), <A HREF="/cgi-bin/man/man2html?1+setxkbmap">setxkbmap</A>(1),
|
|
<A HREF="/cgi-bin/man/man2html?3+XStringToKeysym">XStringToKeysym</A>(3),
|
|
<I>Xlib</I> documentation on key and pointer events
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
<P>
|
|
|
|
Every time a <B>keycode</B> expression is evaluated, the server generates
|
|
a <I>MappingNotify</I> event on every client. This can cause some thrashing.
|
|
All of the changes should be batched together and done at once.
|
|
Clients that receive keyboard input and ignore <I>MappingNotify</I> events
|
|
will not notice any changes made to keyboard mappings.
|
|
<P>
|
|
|
|
<I>Xmodmap</I>
|
|
|
|
should generate "add" and "remove" expressions automatically
|
|
whenever a keycode that is already bound to a modifier is changed.
|
|
<P>
|
|
|
|
There should be a way to have the
|
|
<I>remove</I>
|
|
|
|
expression accept keycodes as well as keysyms for those times when you really
|
|
mess up your mappings.
|
|
<A NAME="lbAK"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
Jim Fulton, MIT X Consortium, rewritten from an earlier version by
|
|
David Rosenthal of Sun Microsystems.
|
|
<P>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="23"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="24"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="25"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="26"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="27"><A HREF="#lbAF">EXPRESSION GRAMMAR</A><DD>
|
|
<DT id="28"><A HREF="#lbAG">EXAMPLES</A><DD>
|
|
<DT id="29"><A HREF="#lbAH">ENVIRONMENT</A><DD>
|
|
<DT id="30"><A HREF="#lbAI">SEE ALSO</A><DD>
|
|
<DT id="31"><A HREF="#lbAJ">BUGS</A><DD>
|
|
<DT id="32"><A HREF="#lbAK">AUTHOR</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:31 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|