# The XKB keymap text format, V1 and V2 {#keymap-text-format-v1-v2} This document describes the following [keymap] formats, as implemented by libxkbcommon:
[xkb_keycodes][indicator name] to define indicators and
[xkb_compat][indicator effect] to define their effects.
| [Component](@ref keymap-component-def) | [Section][section] in a [keymap][xkb_keymap] | Folder in a keymap configuration database | Description |
|---|---|---|---|
| Key codes | [xkb_keycodes] | `keycodes` | A translation of the raw [key codes][keycode] from the keyboard into symbolic names. |
| Compatibility | [xkb_compat] | `compat` | A specification of what internal actions modifiers and various special-purpose keys produce. |
| (Geometry) | xkb_geometry | `geometry` | A description of the physical layout of a keyboard. @attention This legacy feature is [not supported](@ref geometry-support) by _xkbcommon_. |
| Key symbols | [xkb_symbols] | `symbols` | A translation of symbolic [key codes][keycode] into actual [key symbols][keysyms] (*keysyms*). @sa @ref predefined-keysyms |
| Key types | [xkb_types] | `types` | Types describe how a pressed key is affected by active [modifiers] such as Shift, Control, Alt, etc. |
"”.
The following _escape sequences_ are supported:
| Escape sequence | Meaning |
| ------------------ | -------------------------------------------------------- |
| `\\` | Backslash “`\`” |
| `\"` | Double quote “`"`” |
| `\b` | Backspace |
| `\e` | Escape |
| `\f` | Form feed |
| `\n` | Line feed (newline) |
| `\r` | Carriage return |
| `\t` | Horizontal tabulation |
| `\v` | Vertical tabulation |
| `\` + octal number | Corresponding ASCII character: `\1` → `SOH`, `\42` → `"`. Up to **4** octal digits `0‥7` are parsed. The result must fit into a byte. |
| `\u{` + hexadecimal number + `}` | `\u{NNNN}` produce the corresponding [Unicode code point] `U+NNNN`, encoded in [UTF-8]. Supported code points are in the range `U+0001‥U+10FFFF`. |
[Unicode code point]: https://en.wikipedia.org/wiki/Unicode#Codespace_and_code_points
[UTF-8]: https://en.wikipedia.org/wiki/UTF-8
@note The string _encoding_ is unspecified and not validated, but for best
results, stick to ASCII.
@since \<1.9.0: Octal escape sequences accept up to **3** digits.
@since 1.9.0: Octal escape sequences accept up to **4** digits.
Added \\" and `\u{NNNN}` escape sequences.
| Keysym string | Keysym name | Keysym value |
|---|---|---|
| `""` | `NoSymbol` | `0x0000` |
| `"a"` | `a` | `0x0061` |
| `"ü"` | `udiaeresis` | `0x00dc` |
| `"🎺"` | `U1F3BA` | `0x0101F3BA` |
| `"g̃"` | `{g, combining_tilde}` | `{0x0101F3BA, 0x01000303}` |
\%H\%S\%E| Input | Output |
|---|---|
| ```c xkb_symbols { key { [a, A, ae, AE] }; augment "B(S2)" }; ``` | ```c xkb_symbols { // Key unchanged key { [a, A, ae, AE] }; // New key key { [Greek_beta , Greek_BETA] }; }; ``` |
| ```c xkb_symbols { key { [a, A, ae, AE] }; replace "B(S2)" }; ``` | ```c xkb_symbols { // Key replaced key { Greek_alpha, Greek_ALPHA] }; // New key key { [Greek_beta , Greek_BETA ] }; }; ``` |
| ```c xkb_symbols { key { [a, A, ae, AE] }; // Two files merged together with the merge mode // augment, then the result is merged this the // statement above using the override merge mode include "B(S1)|B(S2)" }; ``` | ```c xkb_symbols { // Key overridden: mix of old + new key { [Greek_alpha, Greek_ALPHA, ae, AE] }; // New key; "B(2)" had no effect with the // merge mode augment "|" key { [b, B] }; }; ``` |
[xkb_keycodes][xkb_types][xkb_compat][xkb_symbols]partial@anchor section-flag-partialdefault@anchor section-flag-defaulthidden@anchor section-flag-hiddendefault@anchor section-flag-deprecatedalphanumeric_keys@anchor section-flag-alphanummodifier_keys@anchor section-flag-modifierkeypad_keys@anchor section-flag-keypadfunction_keys@anchor section-flag-functionalternate_group@anchor section-flag-alt-group