! mascheck at faw.uni-ulm.de ! ! "If you're thinking that this is all senselessly ! complicated... you're right." - Jamie Zawinski ! See also the GUI 'xkeycaps' with very good documentation about the ! 'keyboard model' of X11. ! If you want to learn the keyboard model, read there first, and ! the come back for more comments about subtle things. ! By the way, I am working on a Solaris 2.5, X11R5/OW3.5 ! with "Type-5 US Unix" Keyboard ! Why so many '!' here? It's the comment character for xmodmap(1). ! Keycodes in this file certainly only make sense at my own keyboard. ! So you better start with an xmodmap file of your own. ! This file contains raw iso-8859-1 (latin1) characters for documentation. ! ! See for a list ! of available KeySym names (including latin1) inlcuding their printables ! and for a list ! of "compose"(Multi_key)-sequences. ! ! Wether you can really use special (non-ASCII, 8bit) characters, likely will ! depend on your locale settings: ! If you have the XKB Xserver extension (e.g. X11R6/XFree86), then ! see also setxkbmap(1) and several xkb*(1) tools. The according file format ! is sort of similar to "loadkeys". However, i regularly use only ! X11R5 not providing any XKB extension. ! ! The best documentation i found about XKB so far ! is ${X11SRC}/doc/hardcopy/XKB/XKBlib.ps.gz !------------------------------------------------------------------------------ ! How to use an xmodmap file: Add a call to xmodmap(1) to your X11 startup ! script. It's usually ~/.xinitrc for startx(1) and ~/.xsession for display ! managers. ! Don't forget to search for possible appropriate keymaps on your system ! before you write your own. For XFree86, you should properly ! configure XF86Config, at first. !------------------------------------------------------------------------------ ! In the following you will read a lot about "KeySyms". ! (One can even distinguish between "KeySym Names" like ! "backslash", and "KeySyms", which can be used by hexadecimal ! values eventually ("0x5c"). See below.) ! ! X11 uses these logical names for keys--instead of the printables ! themselves or the literal names on the caps. There are KeySym names ! for really all common Keys in X11, and thus it stays independent from the ! myriades of different physical keyboards and slightly different namings. ! To confirm that your remapping (in particular about using modifiers) ! was successful, use xev(1), and xmodmap(1) without options. On Solaris, ! xev(1) is, except for 2.6, 8 and 9 (but in /usr/openwin/demo/), not ! available. The same for some versions of HP-UX. ! See for a glance at the ! source then (and binaries, if you like). ! Apart from the regular KeySyms names, you can also map arbitrary values, ! using the hexadecimal notation (up to four digits): ! xmodmap -e "keycode = 0x" ! [ Pointed out by Florian Weimer, de.comp.os.unix.x11 22-2-01 ] ! ! Related: You can add new KeySym names to XKeysymDB (see xmodmap(1)), ! but later on those new KeySym names will _not_ be recognized from ! XKeysymToString(3). Only the KeySym _value_ is visible and tools like ! xev(1) and xmodmap(1) subsequently behave according to that. !------------------------------------------------------------------------------ ! What's the format of a "keycode-line"? ! (i.e. the result of 'xmodmap -pke' or Sun-'xmakemap') ! ! 'keycode = <1> <2> <3> <4> <5> <6> <7> <8>' ! ! Only the first four are platform independent. ! See below about the last four. ! ! Solaris Openwin 3.5 (X11R5), Type-5 US keyboard ! <1> ! <2> ! <3> <'Mode_switch'-key> ! <4> ! ( <5> <'Num_Lock'-key> ) ! ( <6> - ) ! ( <7> <'Num_Lock'-'Mode_switch'-key> ) ! ( <8> - ) ! ! ! Look at positions 1-4: There are two groups, each with two keys. ! You get the 2nd group with 'Mode_switch' (aka AltGr) and the ! second key in each group with 'Shift'. ! ! The fastest way (in typing) to get special (e.g. latin1) characters ! on US/EN Keyboards is to use 'Mode_switch': ! For this purpose you have to map the KeySym 'Mode_switch' onto a keycode ! of your choice *and* map it to an arbitrary, still available logical ! modifier (called mod1-5 , see below). (Some XFree86 versions accept ! a pure "Mode_switch", though.) ! Certainly you also have to provide the KeySyms for special characters and ! you will usually put them in the second group, i.e. 3rd and 4th position. ! ! (The 'Multi_key/Compose' mechanism in contrast doesn't need to be ! also configured as modifier, but you'll have to type more then ! -- and not all applications support it. However older X11R5 Xservers ! do it completely Xserver internally, then it works always.) ! ! ((Only for the sake of completeness: ! If only a single key is defined in a group (certainly only possible ! with the last in a complete row), then it's a shorthand for both ! small/CAPS KeySym names.)) !------------------------------------------------------------------------------ ! What about position 5-8: ! Those KeySyms are not documented in X11R5/core-X11R6 and very likely ! not available. ! (Take the above example as rare, platform dependent exception. ! And don't be confused by Num_Lock appearing there, the very ! Num_Lock mechanism is configured in a different way, by KP_... ! KeySym names.) ! ! The R5 'X Protocol documentation' says: ! 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.) ! ! ... However, when using the XKB extension, (X11R6), XFree86: ! ! There are KeySyms, that provide switching between even more 'groups'. ! ! /usr/X11R6/include/X11/keysymdef.h: ! ! ISO 9995 Function and Modifier Keys ! [...] ! #ifdef XK_XKB_KEYS ! #define XK_ISO_Group_Shift 0xFF7E /* Alias for mode_switch */ ! #define XK_ISO_Next_Group 0xFE08 ! #define XK_ISO_Prev_Group 0xFE0A ! #define XK_ISO_First_Group 0xFE0C ! #define XK_ISO_Last_Group 0xFE0E ! ! With "ISO_Next_Group" you can switch into the next group of characters. ! Example: If you map a key with the following KeySym names, then you get ! the first four with "Shift" and "Mode_switch"/AltGr. After pressing ! "ISO_Next_Group" twice, you get the last four in the same way. ! ' keycode ... = a A ae AE dollar pound yen currency ' ! ! I only use X11R5 and thus most of my keycodes ! are only mapped with four KeySyms. ! !------------------------------------------------------------------------------ ! Solaris: You'll find several keytables in /usr/openwin/etc/keytables/ ! HP-UX: When using a german keyboard: It may likely map both ! "Meta" and "Mode_switch" on the same key, which is stupid ! as '@' via Meta-Q also closes windows in some applications. ! A few keymaps in /usr/lib/X11. ! AIX-4: See /usr/lpp/X11/defaults/xmodmap//keyboard !------------------------------------------------------------------------------ ! 'General' order for mapping keys and modifiers: ! ! - first clear the logical modifiers (section 1. in the following) ! - then map KeySyms to keycodes (section 2.) ! - and finally map the logical modifiers (section 3.) ! [xkeycaps does 2-1-3, which works as well] ! ! ! [ 1. clear the logical modifiers ] ! ! BTW, it's exactly 5 logical (extra-) modifers, because X11 uses 8 bits ! for all these modifiers (control, shift, lock, mod1-mod5). See . ! ! The number in mod1-mod5 has no meaning itself and thus shouldn't matter. ! However, there are a few exceptions about wrongly hardcoded programs ! and also sort of broken Xserver implementations, see below. ! clear Shift clear Lock clear Control clear Mod1 clear Mod2 clear Mod3 clear Mod4 clear Mod5 !------------------------------------------------------------------------------ ! [ 2. Map KeySyms to keycodes ] ! ! ! KeySyms, which are usually used as *modifier* KeySyms: ! Shift_L/R, Control_L/R, Meta_L/R, Alt_L/R, ! Num_Lock, Multi_key, Mode_switch/script_switch, ! Caps_Lock, Shift_Lock, Hyper_L/R, ... ! ! Pointer Buttons are also Modifiers, but they have no KeySyms. ! So, button handling is very application/toolkit dependent and you ! have to change it individually. See an example in ! . ! ! However, the XKB extension provides at least mechanisms to trigger ! Pointer- and Buttonevents with the keyboard. ! Things you can't do via xmodmap: ! - Let one key simulate the pressing of several others. ! Things you shouldn't do: ! - Don't map really different Modifier KeySyms onto one key. ! e.g. "Meta" and "Mode_switch". See the output of 'xmodmap'. ! Certainly you may have "Meta_L" and "Meta_R" (and perhaps even ! "Alt_L/R" on the same key, as long as they serve the same purpose. ! Modifier KeySyms like 'Mode_switch' or 'Meta_L/R' have to be mapped to ! an arbitrary, still free logical modifier (mod1-5), for to really get ! activated. ! ! When deciding how to do the mapping, you should consider: ! - xv(1) for example actually uses (hardcoded and wrongly) 'mod1' as ! "Meta", e.g. for pixmap cut&paste. Thus Meta_L/R is 'mod1' here, too. ! - In Motif-1, mod1 must be associated with "Alt" or "Meta", ! see VirtualBindings(3). ! - AIX 4.3 (RS6000) recognizes Num_Lock only on Mod5. ! But it's still broken then. I haven't succeded yet in activating its ! funcionality at all. ! (BTW, AIX doesn't recognize Multi_key in several terminal emulators.) ! - Don't be surprised about Num_Lock on HP-UX 10.20 with german keyboard, ! it doesn't lock but you have to hold it. This is probably also the ! case with other keyboards. ! (( Very special and usually not of concern: ! If you often use Meta for command line editing ! (bash/readline u.a., oder sogar emacs) - and if you want to get ! both latin1 chars and command line editing with the same modifier key ! (example: -> ä, -> 'backward word'), then you ! can use the 'translation tables' of libXt, e.g. in xterm(1): ! XTerm.VT100.translations: #override Metaa: string("ä") \n\ [...] )) ! See or the end of this file for the names ! of available KeySyms. ! In the following, mainly keysyms for special characters were added: ! german 'umlauts' (ä ö ü ß) and many other latin1 chars ('° µ ² ³ ©'...) ! ! There is also 'ecaron' on 'e'. It's an iso-latin-2-only character, ! so you'll need also a font to display it. A general example is the ! XFree-xterm in connection with Markus Kuhn's Unicode fonts. ! or ! ! SunOS Type-5 US Keyboard ! ! [Regular keycodes and Keysyms collapsed] ! See !------------------------------------------------------------------------------ ! [ 3. Map the logical modifiers ] ! ! ! (For myself only: My original system defaults were: ! shift Shift_L (0x6a), Shift_R (0x75) ! lock ! control Control_L (0x53) ! mod1 Mode_switch (0x1a) ! mod2 Meta_L (0x7f), Meta_R (0x81) ! mod3 Num_Lock (0x69) ! mod4 Alt_R (0x14) ! mod5 ! ) ! ! Now it's: ! shift Shift_L (0x6a), Shift_R (0x75) ! lock Caps_Lock ! control Control_L (0x53) ! mod1 Meta_L (0x7f) ! mod2 Mode_switch (0x14), Mode_switch (0x1a) ! mod3 Num_Lock (0x69) ! mod4 Alt_R (0x81) ! mod5 add shift = Shift_L Shift_R add lock = Caps_Lock add control = Control_L add mod1 = Meta_L Meta_R add mod2 = Mode_switch add mod3 = Num_Lock ! Alt particularly for emacs(?) add mod4 = Alt_R add mod5 = ! Offtopic: from the xkeycaps documentation ! "Not all vendors support the use of the Multi_key keysym; in ! particular, Digital, Sun, and HP support it, but the X Con- ! sortium does not. (The reason for this, I am told, is that ! ``Compose'' sequences are considered obsolete; the party ! line is that you should be using Input Methods to do this.)" ! ! Later on then: ! "Whether Multi_key works is a property of the Xt library ! (not the X server) [...]" ! ! This however is not true in general. In Sun-X11R5 this is done ! by the Xserver itself. (Perhaps built in by the vendor, though?) !------ End of active xmodmap ------------------------------------------ !---------------------------------------------------------------------------- ! KeySym names from /usr/openwin/include/X11/keysymdef.h ! ! The feature here: Printable characters inserted in front. ! ! /* ! * Latin 1 ! */ ! #ifdef XK_LATIN1 ! ! space ! 1 exclam ! " quotedbl ! # numbersign ! $ dollar ! % percent ! & ampersand ! ' apostrophe ! quoteright /* deprecated */ ! ( parenleft ! ) parenright ! * asterisk ! + plus ! , comma ! - minus ! . period ! / slash ! ! : colon ! ; semicolon ! < less ! = equal ! > greater ! ? question ! @ at ! ! [ bracketleft ! \ backslash ! ] bracketright ! ^ asciicircum ! _ underscore ! ` grave ! quoteleft /* deprecated */ ! ! { braceleft ! | bar ! } braceright ! ~ asciitilde ! ! nobreakspace ! ¡ exclamdown ! ¢ cent ! £ sterling ! ¤ currency ! ¥ yen ! ¦ brokenbar ! § section ! ¨ diaeresis ! © copyright ! ª ordfeminine ! « guillemotleft /* left angle quotation mark */ ! ¬ notsign ! ­ hyphen ! ® registered ! ¯ macron ! ° degree ! ± plusminus ! ² twosuperior ! ³ threesuperior ! ´ acute ! µ mu ! ¶ paragraph ! · periodcentered ! ç cedilla ! ¹ onesuperior ! º masculine ! » guillemotright /* right angle quotation mark */ ! ¼ onequarter ! ½ onehalf ! ¾ threequarters ! ¿ questiondown ! À Agrave ! Á Aacute ! Â Acircumflex ! Ã Atilde ! Ä Adiaeresis ! Å Aring ! Æ AE ! Ç Ccedilla ! È Egrave ! É Eacute ! Ê Ecircumflex ! Ë Ediaeresis ! Ì Igrave ! Í Iacute ! Î Icircumflex ! Ï Idiaeresis ! Ð ETH ! ð Eth /* deprecated */ ! Ñ Ntilde ! Ò Ograve ! Ó Oacute ! Ô Ocircumflex ! Õ Otilde ! Ö Odiaeresis ! × multiply ! Ooblique ! Ù Ugrave ! Ú Uacute ! Û Ucircumflex ! Ü Udiaeresis ! Ý Yacute ! Þ THORN ! þ Thorn /* deprecated */ ! ß ssharp ! à agrave ! á aacute ! â acircumflex ! ã atilde ! ä adiaeresis ! å aring ! æ ae ! ç ccedilla ! è egrave ! é eacute ! ê ecircumflex ! ë ediaeresis ! ì igrave ! í iacute ! î icircumflex ! ï idiaeresis ! ð eth ! ñ ntilde ! ò ograve ! ó oacute ! ô ocircumflex ! õ otilde ! ö odiaeresis ! ÷ division ! ø oslash ! ù ugrave ! ú uacute ! û ucircumflex ! ü udiaeresis ! ý yacute ! þ thorn ! ÿ ydiaeresis ! ! #endif /* XK_LATIN1 */ !---------------------------------------------------------------------------- ! Multi_key sequences ('Compose') ! ! MIT: $SRC/xc/nls/X11/locale/Compose/iso8859-1 ! XFree86: /usr/X11R6/lib/X11/locale/iso8859-1/Compose ! Solaris Openwindows: /usr/openwin/include/X11/Suncompose.h ! Irix6: composetable(5) ! !---------------------------------------------------------------------------- ! In X11R6, there are even 7bit compose sequences, like for video terminals: ! ! + + : # ! A A : @ ! ( ( : [ ! ) ) : ] ! ( - : { ! ) - : } ! / / , / < : \ ! > : ^ ! / ^, V L : | ! - : ~ ! !---------------------------------------------------------------------------- ! 8bit sequences in rather compressed form: ! ! From: Christian Weisgerber ! Newsgroups: de.comp.os.unix.x11 ! Subject: Re: 8 keysym pro keycode !? -- wie benutzen ? ! Message-ID: <869tp8$5d4$1@bigeye.rhein-neckar.de> ! | no-break space ¦ broken bar || ! ­ soft hyphen -- µ micro sign /U ! ¡ inverted ! !! ¿ inverted ? ?? ! ¢ cent sign C/ or C| £ pound sign L- or L= ! ¤ currency sign XO or X0 ¥ yen sign Y- or Y= ! § section sign SO or S! or S0 ¶ pilcrow sign P! ! ¨ diaeresis "" or " ¯ macron _^ or -^ ! ´ acute accent '' ¸ cedilla ,, ! © copyright sign CO or C0 ® registered sign RO ! ª feminine ordinal A_ º masculine ordinal O_ ! « opening angle brackets << » closing angle brakets >> ! ° degree sign 0^ ¹ superscript 1 1^ ! ² superscript 2 2^ ³ superscript 3 3^ ! ± plus or minus sign +- ¼ fraction one-quarter 14 ! ½ fraction one-half 12 ¾ fraction three-quarter 34 ! · middle dot .^ ¬ not sign -, ! × multiplication sign xx ÷ division sign :- ! ! À A grave A` à a grave a` ! Á A acute A' á a acute a' ! Â A circumflex A^ â a circumflex a^ ! Ã A tilde A~ ã a tilde a~ ! Ä A diaeresis A" ä a diaeresis a" ! Å A ring A* å a ring a* ! Æ AE ligature AE æ ae ligature ae ! ! Ç C cedilla C, ç c cedilla c, ! ! È E grave E` è e grave e` ! É E acute E' é e acute e' ! Ê E circumflex E^ ê e circumflex e^ ! Ë E diaeresis E" ë e diaeresis e" ! ! Ì I grave I` ì i grave i` ! Í I acute I' í i acute i' ! Î I circumflex I^ î i circumflex i^ ! Ï I diaeresis I" ï i diaeresis i" ! ! Ð capital eth D- ð small eth d- ! ! Ñ N tilde N~ ñ n tilde n~ ! ! Ò O grave O` ò o grave o` ! Ó O acute O' ó o acute o' ! Ô O circumflex O^ ô o circumflex o^ ! Õ O tilde O~ õ o tilde o~ ! Ö O diaeresis O" ö o diaeresis o" ! Ø O slash O/ ø o slash o/ ! ! Ù U grave U` ù u grave u` ! Ú U acute U' ú u acute u' ! Û U circumflex U^ û u circumflex u^ ! Ü U diaeresis U" ü u diaeresis u" ! ! Ý Y acute Y' ý y acute y' ! ! Þ capital thorn TH þ small thorn th ! ! ß German small sharp s ss ÿ y diaeresis y"