doc/keymap: add documentation for xkb_symbols (#205)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
diff --git a/doc/keymap-format-text-v1.md b/doc/keymap-format-text-v1.md
index eda6ebb..67c58fa 100644
--- a/doc/keymap-format-text-v1.md
+++ b/doc/keymap-format-text-v1.md
@@ -351,11 +351,110 @@ satisfied the LED is lit.
## The `xkb_symbols` section
-This section is the fourth to be processed, after `xkb_keycodes`,
-`xkb_types` and `xkb_compat`.
+NOTE: This section is incomplete.
-TODO
+This section is the fourth to be processed, after `xkb_keycodes`, `xkb_types`
+and `xkb_compat`.
+
+Statements of the form:
+
+ xkb_symbols "basic" {
+ ...
+ }
+
+Declare a symbols map named `basic`. Statements inside the curly braces will
+affect only affect the symbols map.
+
+A map can have various flags applied to it above the statement, separated by
+whitespace:
+
+ partial alphanumeric_keys
+ xkb_symbols "basic" {
+ ...
+ }
+
+The possible flags are the following:
+
+ * `partial` - Indicates that the map doesn't cover a complete keyboard
+ * `default` - Marks the symbol map as the default map in the file when no
+ explicit map is specified. If no map is marked as a default, the first map in
+ the file is the default.
+ * `hidden` - Variant that can only be used internally
+ * `alphanumeric_keys` - Indicates that the map contains alphanumeric keys
+ * `modifier_keys` - Indicates that the map contains modifier keys
+ * `keypad_keys` - Indicates that the map contains keypad keys
+ * `function_keys` - Indicates that the map contains function keys
+ * `alternate_group` - Indicates that the map contains keys for an alternate
+ group
+
+If no `*_keys` flags are supplied, then the map is assumed to cover a complete
+keyboard.
+
+At present, except for `default`, none of the flags affect key processing in
+libxkbcommon, and only serve as metadata.
+
+### Name statements
+
+Statements of the form:
+
+ name[Group1] = "US/ASCII";
+ groupName[1] = "US/ASCII";
+
+Gives the name "US/ASCII" to the first group of symbols. Other groups can be
+named using a different group index (ex: `Group2`), and with a different name.
+A group must be named.
+
+`group` and `groupName` mean the same thing, and the `Group` in `Group1` is
+optional.
+
+### Include statements
+Statements of the form:
+
+ include "nokia_vndr/rx-51(nordic_base)
+
+Will include data from another `xkb_symbols` section, possibly located in
+another file. Here it would include the `xkb_symbols` section called
+`nordic_base`, from the file `rx-51` located in the `nokia_vndr` folder, itself
+located in an XKB include path.
+
+### Key statement
+
+Statements of the form:
+
+ key <AD01> { [ q, Q ] };
+
+Describes the mapping of a keycode `<AD01>` to a given group of symbols. The
+symbols are `q` and `Q` in this example.
+
+The possible keycodes are the keycodes defined in the `xkb_keycodes` section.
+
+Symbols are named using the symbolic names from the
+`xkbcommon/xkbcommon-keysyms.h` file. A group of symbols is enclosed in brackets
+and separated by commas. Each element of the symbol arrays corresponds to a
+different modifier level.
+
+#### Groups
+
+Each group represents a list of symbols mapped to a keycode:
+
+ name[Group1]= "US/ASCII";
+ name[Group2]= "Russian";
+ ...
+ key <AD01> { [ q, Q ],
+ [ Cyrillic_shorti, Cyrillic_SHORTI ] };
+
+The long-form syntax can also be used to represent groups:
+
+ key <AD01> {
+ symbols[Group1]= [ q, Q ],
+ symbols[Group2]= [ Cyrillic_shorti, Cyrillic_SHORTI ]
+ };
+
+Groups can also be omitted, but the brackets must be present. The following
+statement only defines the Group3 of a mapping:
+
+ key <AD01> { [], [], [ q, Q ] };
## Virtual modifier statements
@@ -366,3 +465,4 @@ Statements of the form:
Can appear in the `xkb_types`, `xkb_compat`, `xkb_symbols` sections.
TODO
+