Files
RedBear-OS/local/docs/operator-runbooks/redbear-keymapd.md
T
vasilito 9f2de2a0b1 docs+build: correct version drift, mangled prose, and toolchain-version gaps
Docs:
- Baseline was stated as 0.3.1 across the canonical set while the branch,
  Cat 0/1 crates and every Cat 2 fork are 0.3.2. AGENTS.md also cited a
  sources/redbear-0.3.1/ archive that does not exist; the only archive
  present is sources/redbear-0.1.0/. Versioning examples now match the
  forks as they actually stand (redoxfs/syscall 0.9.1, libredox 0.1.19).
- Repaired 18 instances of 'immutable archived' across 8 documents, where
  a global find/replace had turned sync/synced/archived into that phrase
  and produced ungrammatical text ('never auto-immutable archived',
  '### Source immutable archived').
- Settled the apply-patches.sh contradiction empirically. Both sides were
  wrong: the GROSS WARNING blocks (x5) described it as routine
  patch-linking, and SCRIPT-BEHAVIOR-MATRIX.md said build-redbear.sh
  'never invokes' it. It is invoked at build-redbear.sh:487, but only to
  auto-repair a failed verify-overlay-integrity.sh check.
- Dropped the dangling reference to a local/AGENTS.md section
  'NO OVERLAY-STYLE PATCHES — SCOPED POLICY' that does not exist.

Build system:
- mk/prefix.mk hardcoded 13.2.0 in the limits.h removal, which silently
  no-ops after a toolchain upgrade and leaves the conflicting header.
  Version-globbed.
- Parameterized GCC_RECIPE so the from-source toolchain path is not
  pinned to gcc13.
- The three cstdlib strtold seds were not idempotent -- the shipped GCC
  13 toolchain carried that comment block 17 times from repeated
  'make prefix' runs. Each is now guarded.
2026-08-03 13:07:25 +03:00

3.3 KiB

redbear-keymapd — Operator Runbook

Daemon: redbear-keymapd Init service: /usr/lib/init.d/62_keymapd.service Status check: cat /scheme/keymap/active Restart: init-svc restart keymapd

Logs

  • Destination: stderr (tagged [keymapd])
  • No env-var log level control; all messages are INFO or ERROR level. Keymap load success/failure is logged at startup.

Scheme

  • Scheme name: keymap
  • Root: /scheme/keymap/ (directory, mode 0555)

Scheme Paths

Path Type Mode Description
active file 0644 R/W: current keymap name. Read returns name=<keymap>. Write a keymap name to switch.
list file 0644 Read-only: newline-separated list of available keymap names
keymap/<name> file 0644 Read-only: per-keymap detail (entries, compose, dead_keys, sample codepoints)
set/<name> action Open this path to activate keymap <name> (alternative to writing active)

Built-in Keymaps (always available)

Name Description
us US QWERTY (default)
gb UK QWERTY
dvorak Dvorak simplified layout
azerty French AZERTY
bepo French Bépo ergonomic layout
it Italian QWERTY

Configuration

  • KEYMAP_DIR — Directory to scan for JSON keymap files (default: /etc/keymaps)
  • XKB_CONFIG_ROOT — xkbcommon XKB data directory (e.g. /usr/share/X11/xkb). If set, the daemon loads an XKB keymap.
  • XKB_DEFAULT_LAYOUT — XKB layout name (default: us)
  • XKB_DEFAULT_VARIANT — Optional XKB variant (e.g. dvorak, intl)

JSON Keymap Format

Keymap files in KEYMAP_DIR must have .json extension. The daemon calls Keymap::from_json(&name, &json_str) to parse each file. The JSON format is documented in keymap.rs.

Scancode Translation

  • translate(scancode: u8, shift: bool, altgr: bool) -> char
  • Sample: cat /scheme/keymap/active shows sample_scancode_30= (scancode 0x1E = 'a' key, unshifted)

Signals / SIGTERM Behavior

  • No SIGTERM handler. Scheme socket close triggers clean exit. Registered via register_sync_scheme.

Common Issues

  1. failed to register scheme:keymap — Another daemon already registered the scheme name.
  2. failed to load keymaps from <dir> — The directory does not exist or contains invalid JSON. Check file permissions and JSON syntax. The error is non-fatal; built-in keymaps are always available.
  3. XKB keymap not loading — Requires XKB_CONFIG_ROOT to point at a valid xkbcommon data tree. The daemon calls xkb::load_xkb_keymap() which reads keycodes/, symbols/, types/, compat/ subdirectories. Without XKB_CONFIG_ROOT, only built-in + JSON keymaps are available.
  4. Keymap switch not taking effect — Write the keymap name to /scheme/keymap/active or open /scheme/keymap/set/<name>. Verify the name exists in cat /scheme/keymap/list. The compositor/terminal must re-read the active keymap after a switch — the daemon only updates its internal state.
  5. sample_scancode_30 shows 'a' when expecting another character — Verify the keymap is actually active (cat /scheme/keymap/active returns name=<expected>). If active shows the correct keymap, check the keymap's own scancode table (cat /scheme/keymap/keymap/<name>).