Skip to main content

Module keymap

Module keymap 

Source
Expand description

Seat keymap ownership: base layout plus batched overlay keysym binding. Compositor-side keymap policy: one owner for the seat keymap.

The seat keymap is BASE text (US by default, replaceable at runtime with a full XKB_KEYMAP_FORMAT_TEXT_V1 string or RMLVO names) plus an OVERLAY of spare keycodes bound to keysyms the base cannot produce (Unicode / IME output). All rebinds are batched: resolving N new keysyms produces ONE keymap swap, and a keycode that is currently held down is never recycled, so its release event always means the symbol its press meant.

Structs§

KeymapPolicy
Seat keymap state: the base text, its reverse keysym map, and the overlay slots.

Constants§

OVERLAY_CAPACITY
Overlay slot count (keycodes OVERLAY_FIRST..=OVERLAY_LAST).
OVERLAY_FIRST_KEYCODE
First overlay keycode. Sits above both the evdev/pc105 range and the legacy selkies overlay range (257-272) so a base keymap carrying those legacy binds cannot collide.
OVERLAY_LAST_KEYCODE
Last overlay keycode (inclusive). Keycodes past the X11 255 ceiling are fine for pure-Wayland clients: they look keycodes up in the delivered keymap via xkbcommon.

Functions§

compile_keymap
Compile an XKB_KEYMAP_FORMAT_TEXT_V1 string, or None when it does not compile.
compile_rmlvo
Compile RMLVO names to keymap text, or None when compilation fails. Empty strings select the xkbcommon defaults for that component.
keysym_for_char
Keysym one literal character types as: Latin-1 printables map 1:1, \n types Return (the raw utf32 table maps it to Linefeed, which no keymap binds), other control characters their 0xffXX function keysyms, everything else the 0x01000000 | codepoint Unicode form (0 = unmappable). The keysym then resolves against an ACTIVE keymap, never a hardcoded layout table.
level0_syms
Level-0 keysym for every key of a compiled keymap (used to pre-bind a virtual-keyboard client’s keymap in one batch). Keys with zero or multiple level-0 syms are skipped.