{
    "content": [
        {
            "type": "text",
            "text": "# keymaps(5) (man)\n\n**Summary:** keymaps - keyboard table descriptions for loadkeys and dumpkeys\n\n## Examples\n\n- `(Be careful to use a keymaps line, like the first line of `dumpkeys`, or  \"keymaps  0-15\"  or`\n- `so.)`\n- `The following entry exchanges the left Control key and the Caps Lock key on the keyboard:`\n- `keycode  58 = Control`\n- `keycode  29 = CapsLock`\n- `Key number 58 is normally the Caps Lock key, and key number 29 is normally the Control key.`\n- `The  following  entry  sets the Shift and Caps Lock keys to behave more nicely, like in older`\n- `typewriters. That is, pressing Caps Lock key once or more sets the keyboard in CapsLock state`\n- `and pressing either of the Shift keys releases it.`\n- `keycode  42 = UncapsShift`\n- `keycode  54 = UncapsShift`\n- `keycode  58 = CapsOn`\n- `The  following entry sets the layout of the edit pad in the enhanced keyboard to be more like`\n- `that in the VT200 series terminals:`\n- `keycode 102 = Insert`\n- `keycode 104 = Remove`\n- `keycode 107 = Prior`\n- `shift keycode 107 = ScrollBackward`\n- `keycode 110 = Find`\n- `keycode 111 = Select`\n- `control alt   keycode 111 = Boot`\n- `control altgr keycode 111 = Boot`\n- `Here's an example to bind the string \"du\\ndf\\n\" to the key AltGr-D. We use the \"spare\" action`\n- `code F100 not normally bound to any key.`\n- `altgr keycode 32 = F100`\n- `string F100 = \"du\\ndf\\n\"`\n\n## See Also\n\n- loadkeys(1)\n- dumpkeys(1)\n- showkey(1)\n- xmodmap(1)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **DESCRIPTION** (14 lines)\n- **INCLUDE FILES** (4 lines)\n- **CHARSET DEFINITIONS** (7 lines)\n- **COMPLETE KEYCODE DEFINITIONS** (132 lines)\n- **SINGLE MODIFIER DEFINITIONS** (18 lines)\n- **STRING DEFINITIONS** (10 lines)\n- **COMPOSE DEFINITIONS** (6 lines)\n- **ABBREVIATIONS** (2 lines) — 2 subsections\n  - strings as usual (2 lines)\n  - compose as usual for \"iso-8859-1\" (9 lines)\n- **EXAMPLES** (36 lines)\n- **SEE ALSO** (5 lines)\n\n## Full Content\n\n### NAME\n\nkeymaps - keyboard table descriptions for loadkeys and dumpkeys\n\n### DESCRIPTION\n\nThese  files are used by loadkeys(1) to modify the translation tables used by the kernel key‐\nboard driver and generated by dumpkeys(1) from those translation tables.\n\nThe format of these files is vaguely similar to the one accepted  by  xmodmap(1).   The  file\nconsists of charset or key or string definition lines interspersed with comments.\n\nComments are introduced with !  or # characters and continue to the end of the line. Anything\nfollowing one of these characters on that line is ignored. Note that comments need not  begin\nfrom column one as with xmodmap(1).\n\nThe syntax of keymap files is line oriented; a complete definition must fit on a single logi‐\ncal line. Logical lines can, however, be split into multiple physical lines  by  ending  each\nsubline with the backslash character (\\).\n\n### INCLUDE FILES\n\nA keymap can include other keymaps using the syntax\n\ninclude \"pathname\"\n\n### CHARSET DEFINITIONS\n\nA character set definition line is of the form:\n\ncharset \"iso-8859-x\"\n\nIt  defines how following keysyms are to be interpreted.  For example, in iso-8859-1 the sym‐\nbol mu (or micro) has code 0265, while in iso-8859-7 the letter mu has code 0354.\n\n### COMPLETE KEYCODE DEFINITIONS\n\nEach complete key definition line is of the form:\n\nkeycode keynumber = keysym keysym keysym...\n\nkeynumber is the internal identification number of the key, roughly equivalent  to  the  scan\ncode  of it.  keynumber can be given in decimal, octal or hexadecimal notation.  Octal is de‐\nnoted by a leading zero and hexadecimal by the prefix 0x.\n\nEach of the keysyms represent keyboard actions, of which up to 256 can be bound to  a  single\nkey. The actions available include outputting character codes or character sequences, switch‐\ning consoles or keymaps, booting the machine etc. (The complete list  can  be  obtained  from\ndumpkeys(1) by saying  dumpkeys -l .)\n\nEach  keysym  may  be prefixed by a '+' (plus sign), in wich case this keysym is treated as a\n\"letter\" and therefore affected by the \"CapsLock\" the same way as by \"Shift\" (to be  correct,\nthe CapsLock inverts the Shift state).  The ASCII letters ('a'-'z' and 'A'-'Z') are made Cap‐\nsLock'able by default.  If Shift+CapsLock should not produce a lower case symbol,  put  lines\nlike\n\nkeycode 30 = +a  A\n\nin the map file.\n\nWhich  of  the actions bound to a given key is taken when it is pressed depends on what modi‐\nfiers are in effect at that moment.  The keyboard driver supports 9  modifiers.  These  modi‐\nfiers are labeled (completely arbitrarily) Shift, AltGr, Control, Alt, ShiftL, ShiftR, CtrlL,\nCtrlR and CapsShift.  Each of these modifiers has an associated weight of power  of  two  ac‐\ncording to the following table:\n\n\nmodifier            weight\n\nShift                  1\nAltGr                  2\nControl                4\nAlt                    8\nShiftL                16\nShiftR                32\nCtrlL                 64\nCtrlR                128\nCapsShift            256\n\nThe  effective  action of a key is found out by adding up the weights of all the modifiers in\neffect. By default, no modifiers are in effect, so action number zero, i.e. the  one  in  the\nfirst  column  in  a  key definition line, is taken when the key is pressed or released. When\ne.g. Shift and Alt modifiers are in effect, action number nine (from the 10th column) is  the\neffective one.\n\nChanging the state of what modifiers are in effect can be achieved by binding appropriate key\nactions to desired keys. For example, binding the symbol Shift to a key sets the Shift  modi‐\nfier  in effect when that key is pressed and cancels the effect of that modifier when the key\nis released. Binding AltGrLock to a key sets AltGr in effect when the  key  is  pressed  and\ncancels  the effect when the key is pressed again.  (By default Shift, AltGr, Control and Alt\nare bound to the keys that bear a similar label; AltGr may denote the right Alt key.)\n\nNote that you should be very careful when binding the modifier keys, otherwise you can end up\nwith  an  unusable  keyboard  mapping. If you for example define a key to have Control in its\nfirst column and leave the rest of the columns to be VoidSymbols, you're in trouble. This  is\nbecause pressing the key puts Control modifier in effect and the following actions are looked\nup from the fifth column (see the table above). So, when you release the key, the action from\nthe  fifth  column is taken. It has VoidSymbol in it, so nothing happens. This means that the\nControl modifier is still in effect, although you have released the key.  Re-pressing and re‐\nleasing  the  key  has  no effect. To avoid this, you should always define all the columns to\nhave the same modifier symbol. There is a handy short-hand notation for this, see below.\n\nkeysyms can be given in decimal, octal, hexadecimal, unicode or symbolic notation.   The  nu‐\nmeric  notations use the same format as with keynumber.  Unicode notation is \"U+\" followed by\nfour hexadecimal digits.  The symbolic notation resembles that used by  xmodmap(1).   Notable\ndifferences  are  the number symbols. The numeric symbols '0', ..., '9' of xmodmap(1) are re‐\nplaced with the corresponding words 'zero', 'one', ... 'nine' to avoid confusion with the nu‐\nmeric notation.\n\nIt  should  be  noted that using numeric notation for the keysyms is highly unportable as the\nkey action numbers may vary from one kernel version to another and the use of  numeric  nota‐\ntions  is thus strongly discouraged. They are intended to be used only when you know there is\na supported keyboard action in your kernel for which your current version of loadkeys(1)  has\nno symbolic name.\n\nThere  is  a number of short-hand notations to add readability and reduce typing work and the\nprobability of typing-errors.\n\nFirst of all, you can give a map specification line, of the form\n\nkeymaps 0-2,4-5,8,12\n\nto indicate that the lines of the keymap will not specify all 256 columns, but only the indi‐\ncated  ones.  (In  the example: only the plain, Shift, AltGr, Control, Control+Shift, Alt and\nControl+Alt maps, that is, 7 columns instead of 256.)   When  no  such  line  is  given,  the\nkeymaps  0-M will be defined, where M+1 is the maximum number of entries found in any defini‐\ntion line.\n\nNext, you can leave off any trailing VoidSymbol entries from a key definition line.  VoidSym‐\nbol  denotes  a keyboard action which produces no output and has no other effects either. For\nexample, to define key number 30 to output 'a' unshifted, 'A' when pressed with Shift and  do\nnothing when pressed with AltGr or other modifiers, you can write\n\nkeycode  30 = a     A\n\ninstead of the more verbose\n\nkeycode  30 = a     A    VoidSymbol     VoidSymbol \\\nVoidSymbol VoidSymbol VoidSymbol ...\n\nFor  added convenience, you can usually get off with still more terse definitions. If you en‐\nter a key definition line with only and exactly one action code after the equals sign, it has\na  special  meaning.  If  the code (numeric or symbolic) is not an ASCII letter, it means the\ncode is implicitly replicated through all columns being defined.  If, on the other hand,  the\naction  code  is  an ASCII character in the range 'a', ..., 'z' or 'A', ..., 'Z' in the ASCII\ncollating sequence, the following definitions are made for the  different  modifier  combina‐\ntions,  provided  these are actually being defined.  (The table lists the two possible cases:\neither the single action code is a lower case letter, denoted by 'x' or an upper case letter,\ndenoted by 'Y'.)\n\nmodifier                symbol\n\nnone                    x              Y\nShift                   X              y\nAltGr                   x              Y\nShift+AltGr             X              y\nControl                 Controlx      Controly\nShift+Control           Controlx      Controly\nAltGr+Control           Controlx      Controly\nShift+AltGr+Control     Controlx      Controly\nAlt                     Metax         MetaY\nShift+Alt               MetaX         Metay\nAltGr+Alt               Metax         MetaY\nShift+AltGr+Alt         MetaX         Metay\nControl+Alt             MetaControlx MetaControly\nShift+Control+Alt       MetaControlx MetaControly\nAltGr+Control+Alt       MetaControlx MetaControly\nShift+AltGr+Control+Alt MetaControlx MetaControly\n\n### SINGLE MODIFIER DEFINITIONS\n\nAll  the  previous  forms of key definition lines always define all the M+1 possible modifier\ncombinations being defined, whether the line actually contains that many action codes or not.\nThere is, however, a variation of the definition syntax for defining only single actions to a\nparticular modifier combination of a key. This is especially useful, if  you  load  a  keymap\nwhich  doesn't match your needs in only some modifier combinations, like AltGr+function keys.\nYou can then make a small local file redefining only those modifier combinations and  loading\nit after the main file.  The syntax of this form is:\n\n{ plain | <modifier sequence> } keycode keynumber = keysym\n\n, e.g.,\nplain keycode 14 = BackSpace\ncontrol alt keycode 83 = Boot\nalt keycode 105 = DecrConsole\nalt keycode 106 = IncrConsole\nUsing \"plain\" will define only the base entry of a key (i.e. the one with no modifiers in ef‐\nfect) without affecting the bindings of other modifier combinations of that key.\n\n### STRING DEFINITIONS\n\nIn addition to comments and key definition lines, a keymap can  contain  string  definitions.\nThese are used to define what each function key action code sends. The syntax of string defi‐\nnitions is:\n\nstring keysym = \"text\"\n\ntext can contain literal characters, octal character codes in the format  of  backslash  fol‐\nlowed  by  up  to three octal digits, and the three escape sequences \\n, \\\\, and \\\", for new‐\nline, backslash and quote, respectively.\n\n### COMPOSE DEFINITIONS\n\nThen there may also be compose definitions. They have syntax\n\ncompose 'char' 'char' to 'char'\nand describe how two bytes are combined to form a third one (when a dead  accent  or  compose\nkey is used).  This is used to get accented letters and the like on a standard keyboard.\n\n### ABBREVIATIONS\n\nVarious abbreviations can be used with kbd-0.96 and later.\n\n#### strings as usual\n\nDefines the usual values of the strings (but not the keys they are bound to).\n\n#### compose as usual for \"iso-8859-1\"\n\nDefines the usual compose combinations.\n\nTo find out what keysyms there are available for use in keymaps, use the command\n\ndumpkeys --long-info\n\nUnfortunately,  there  is  currently  no  description  of what each symbol does. It has to be\nguessed from the name or figured out from the kernel sources.\n\n### EXAMPLES\n\n(Be careful to use a keymaps line, like the first line of `dumpkeys`, or  \"keymaps  0-15\"  or\nso.)\n\nThe following entry exchanges the left Control key and the Caps Lock key on the keyboard:\n\nkeycode  58 = Control\nkeycode  29 = CapsLock\n\nKey number 58 is normally the Caps Lock key, and key number 29 is normally the Control key.\n\nThe  following  entry  sets the Shift and Caps Lock keys to behave more nicely, like in older\ntypewriters. That is, pressing Caps Lock key once or more sets the keyboard in CapsLock state\nand pressing either of the Shift keys releases it.\n\nkeycode  42 = UncapsShift\nkeycode  54 = UncapsShift\nkeycode  58 = CapsOn\n\nThe  following entry sets the layout of the edit pad in the enhanced keyboard to be more like\nthat in the VT200 series terminals:\n\nkeycode 102 = Insert\nkeycode 104 = Remove\nkeycode 107 = Prior\nshift keycode 107 = ScrollBackward\nkeycode 110 = Find\nkeycode 111 = Select\ncontrol alt   keycode 111 = Boot\ncontrol altgr keycode 111 = Boot\n\nHere's an example to bind the string \"du\\ndf\\n\" to the key AltGr-D. We use the \"spare\" action\ncode F100 not normally bound to any key.\n\naltgr keycode 32 = F100\nstring F100 = \"du\\ndf\\n\"\n\n### SEE ALSO\n\nloadkeys(1), dumpkeys(1), showkey(1), xmodmap(1)\n\n\n\nkbd                                         24 April 1998                                 KEYMAPS(5)\n\n"
        }
    ],
    "structuredContent": {
        "command": "keymaps",
        "section": "5",
        "mode": "man",
        "summary": "keymaps - keyboard table descriptions for loadkeys and dumpkeys",
        "synopsis": null,
        "flags": [],
        "examples": [
            "(Be careful to use a keymaps line, like the first line of `dumpkeys`, or  \"keymaps  0-15\"  or",
            "so.)",
            "The following entry exchanges the left Control key and the Caps Lock key on the keyboard:",
            "keycode  58 = Control",
            "keycode  29 = CapsLock",
            "Key number 58 is normally the Caps Lock key, and key number 29 is normally the Control key.",
            "The  following  entry  sets the Shift and Caps Lock keys to behave more nicely, like in older",
            "typewriters. That is, pressing Caps Lock key once or more sets the keyboard in CapsLock state",
            "and pressing either of the Shift keys releases it.",
            "keycode  42 = UncapsShift",
            "keycode  54 = UncapsShift",
            "keycode  58 = CapsOn",
            "The  following entry sets the layout of the edit pad in the enhanced keyboard to be more like",
            "that in the VT200 series terminals:",
            "keycode 102 = Insert",
            "keycode 104 = Remove",
            "keycode 107 = Prior",
            "shift keycode 107 = ScrollBackward",
            "keycode 110 = Find",
            "keycode 111 = Select",
            "control alt   keycode 111 = Boot",
            "control altgr keycode 111 = Boot",
            "Here's an example to bind the string \"du\\ndf\\n\" to the key AltGr-D. We use the \"spare\" action",
            "code F100 not normally bound to any key.",
            "altgr keycode 32 = F100",
            "string F100 = \"du\\ndf\\n\""
        ],
        "see_also": [
            {
                "name": "loadkeys",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/loadkeys/1/json"
            },
            {
                "name": "dumpkeys",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/dumpkeys/1/json"
            },
            {
                "name": "showkey",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/showkey/1/json"
            },
            {
                "name": "xmodmap",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/xmodmap/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 14,
                "subsections": []
            },
            {
                "name": "INCLUDE FILES",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "CHARSET DEFINITIONS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "COMPLETE KEYCODE DEFINITIONS",
                "lines": 132,
                "subsections": []
            },
            {
                "name": "SINGLE MODIFIER DEFINITIONS",
                "lines": 18,
                "subsections": []
            },
            {
                "name": "STRING DEFINITIONS",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "COMPOSE DEFINITIONS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "ABBREVIATIONS",
                "lines": 2,
                "subsections": [
                    {
                        "name": "strings as usual",
                        "lines": 2
                    },
                    {
                        "name": "compose as usual for \"iso-8859-1\"",
                        "lines": 9
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 36,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}