Repository navigation
mute-switch: replace Python daemon with a small C99 helper - #222
Merged
Merged
Conversation
The persistent Python 3 omarchy-mute-switch daemon consumed ~9.8 MiB (RSS + swap) on 1 GB boards just to poll evdev for KEY_MUTE on gpio-keys and external keyboards. Replace it with a zero-dependency C99 binary (~31 KB ELF, ~0.5 MiB RSS) compiled alongside wvkbd and wtype in Makefile and audited by release/audit.py. Preserves full behaviour (kernel-width bitmap parsing, 300 ms settle/debounce, suspend/resume stability, PID flag, external keyboard Mute forwarding) plus exponential retry backoff (2 s to 60 s) and deduplicated stderr logging when no audio sink exists. Assisted-by: LLM
Assisted-by: LLM
mute-switch.c includes linux/input.h, 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: # Makefile # desktop/install-tree # release/audit.py # tests/package_tree.py # tests/test_package.py
Contributor
|
Merged, thank you Tom! Another Python daemon gone, and the back-off is a nice touch. On your branch we merged main in (it now builds next to the C power daemon from #231) and moved the changelog line from the 0.4.6 section up to Unreleased. #213, which this replaces, was already closed. Next up: #227. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
omarchy-mute-switchdaemon (~9.8 MiBRSS + swap on 1 GB iPhone 6) with a zero-dependency C99 binary (desktop/configuration/mute-switch.c,~31 KBELF /~0.5 MiBRSS) compiled alongsidewvkbdandwtypeinMakefile, staged bydesktop/install-tree, and architecture-audited byrelease/audit.py.unsigned long-widthcapabilities/keybitmap parsing (32-bitarmv7hand 64-bitaarch64),300 mssettle/debounce, suspend/resume stability viaEVIOCGKEY, atomic PID flag in$XDG_RUNTIME_DIR/omarchy-mute-switch, and external keyboardKEY_MUTEforwarding.2 s → 60 s, reset on switch move or success), deduplicated stderr logging when no audio output exists yet, and5 s/10 sidle liveness / keyboard rescan intervals.Testing
cc -O2 -Wall -Wextra -Werror -std=c99.tests/test_mute_switch.pyto compile and test the C binary directly (5/5pass).tests/test_package_staging.py(7/7) andtests/test_package.py(22/22) pass.