1

The keymap source (in .xkb format) of the current XKB configuration can be obtained by running xkbcomp $DISPLAY -. Mapping to keysyms is done in the xkb_symbols section of this file. Some of the definitions in this section explicitly define the key type, which indicates which modifiers index the various keysym levels; for example:

key <AD01> {type= "ALPHABETIC", [q, Q]};

Other lines do not specify their type; for example:

key <AE01> {[1, exclam]};

In this case, the type is ambiguous, as there are multiple two-level types defined in the xkb_types section of this file (TWO_LEVEL, ALPHABETIC, KEYPAD, SHIFT+ALT, PC_SUPER_LEVEL2, etc.). Hence, there must be implicit (or default) types for a given number of levels (e.g., an implicit two-level type when no type is given but two levels are present). Where are these implicit types defined? Is it simply the first type appearing in xkb_types that has the requisite number of levels?

user001
  • 3,598
  • 5
  • 39
  • 54

1 Answers1

2

The defaults are specified in the The X Keyboard Extension: Protocol Specification for X11R6.4 in section 12.2.3 (pp. 41-42) and Appendix B. Specifically, ONE_LEVEL, TWO_LEVEL, ALPHABETIC, and KEYPAD are considered canonical types, and are selected, after alphanumeric expansion, in accordance with the following criteria:

For each keyboard group that does not have an explicit type definition, XKB chooses a key type from the canonical key types. If the second symbol assigned to a group is NoSymbol (after alphabetic expansion), the server assigns key type ONE_LEVEL. If the group contains the lowercase and uppercase forms of a single glyph (after alphanumeric expansion), the server assigns key type ALPHABETIC. If either of the symbols in a group is a numeric keypad keysym (KP_*), the server assigns key type KEYPAD. Otherwise, it assigns key type TWO_LEVEL.

The protocol does not specify canonical types for groups having more than two levels.

user001
  • 3,598
  • 5
  • 39
  • 54