Summary
Three macOS resilience improvements were added to keypath/bundled and should be proposed upstream to jtroo/kanata once validated in production.
Changes
-
Port idle-clearing of stuck key states from Windows (c42d73a)
- After 60s of no physical input, clears stuck keyberon normal-key states and PRESSED_KEYS
- Mirrors the existing Windows LLHOOK
clear_states_from_inactivity() mechanism
- Addresses stuck keys caused by CPU pressure delaying release events
-
Processing loop latency canary (52e61fc)
- Logs
[LATENCY] at info level when a processing iteration takes >20ms
- Always active, no allocation on the fast path, not platform-gated
- Aids post-hoc diagnosis of stuck key incidents
-
Latency-triggered soft reset (85330a1)
- After 5 consecutive slow iterations (>20ms each), clears all stuck key states
- Releases keyberon states, PRESSED_KEYS, and tracked output keys
- Does NOT release/regrab the HID device (no disruptive keyboard dropout)
- macOS-only
Context
On macOS, CPU/memory pressure (compilation, Spotlight indexing) can starve the processing thread, delaying release events and leaving keys stuck. Windows already has idle-clearing for similar scenarios (Win+L lock screen). These changes extend that resilience to macOS.
Before upstreaming
Summary
Three macOS resilience improvements were added to
keypath/bundledand should be proposed upstream tojtroo/kanataonce validated in production.Changes
Port idle-clearing of stuck key states from Windows (
c42d73a)clear_states_from_inactivity()mechanismProcessing loop latency canary (
52e61fc)[LATENCY]at info level when a processing iteration takes >20msLatency-triggered soft reset (
85330a1)Context
On macOS, CPU/memory pressure (compilation, Spotlight indexing) can starve the processing thread, delaying release events and leaving keys stuck. Windows already has idle-clearing for similar scenarios (Win+L lock screen). These changes extend that resilience to macOS.
Before upstreaming
defcfgjtroo/kanatawith appropriate upstream commit messages