Skip to content

Port omarchy-keyboard controller and listener to C99 - #228

Merged
henrikklee merged 4 commits into
OrchardLinux:mainfrom
tcballard:perf-keyboard-c
Dec 6, 2026
Merged

henrikklee merged 4 commits into
OrchardLinux:mainfrom
tcballard:perf-keyboard-c

Conversation

@tcballard

Copy link
Copy Markdown
Contributor

Replaces the Python 3 omarchy-keyboard script with a zero-dependency C99 binary (desktop/configuration/keyboard.c, ~40 KB ELF).

  • Frees ~11 MiB of resident RAM from the long-running omarchy-keyboard listen daemon (~0.5 MiB RSS vs 11.7 MiB RSS+Swap).
  • Eliminates Python interpreter startup delay on every show|hide|toggle|quiet|hold|release invocation.
  • Preserves exact policy state-machine semantics, Unix datagram IPC, colors.toml parsing, and wlr-randr --json phone-layout detection.
  • Updated tests/test_keyboard_policy.py to compile keyboard.c and run all 35 original policy/phone-layout tests verbatim plus 2 new end-to-end tests.

Tested: 74/74 pass (test_keyboard_policy.py, test_keyboard_shortcuts.py, test_package_staging.py, test_package.py).

tcballard and others added 3 commits December 2, 2026 11:25
Replaces the Python 3 omarchy-keyboard script with a zero-dependency C99
binary (desktop/configuration/keyboard.c).

omarchy-keyboard listen runs continuously for the entire session (11.7 MiB
RSS+Swap as Python 3) and omarchy-keyboard show|hide|toggle|quiet|hold|release
is spawned on every text-field tap, dismissal, and control-center toggle.
The C99 binary (~40 KB ELF, ~0.5 MiB RSS) eliminates both the resident
Python interpreter and per-invocation interpreter startup latency while
preserving exact policy semantics, colors.toml parsing, and wlr-randr
phone-layout detection.

Assisted-by: LLM
keyboard.c uses SOCK_NONBLOCK and SOCK_CLOEXEC, which macOS lacks; the
repository's suite is green on both, and a test that needs what a Mac
lacks skips with its reason (AGENTS.md).

Assisted-by: LLM
# Conflicts:
#	CHANGELOG.md
#	Makefile
#	desktop/install-tree
#	release/audit.py
#	tests/package_tree.py
#	tests/test_package.py
@henrikklee
henrikklee merged commit 1b356d5 into OrchardLinux:main Dec 6, 2026
11 checks passed
@henrikklee

Copy link
Copy Markdown
Contributor

Merged, thank you Tom! The keyboard is the helper people touch most, so dropping the Python start-up here is very welcome.

On your branch we merged main in after #221 (the keyboard buffer change) landed. The two didn't overlap in code, only in the shared build files, which now list the keyboard controller next to the other C helpers. We also added the changelog line. Next up: #229.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants