Skip to content

feat(tcp): add ChordResolved and TapDanceResolved server events - #17

Merged
malpern merged 7 commits into
mainfrom
worktree-chord-tap-dance-tcp
May 22, 2026
Merged

feat(tcp): add ChordResolved and TapDanceResolved server events#17
malpern merged 7 commits into
mainfrom
worktree-chord-tap-dance-tcp

Conversation

@malpern

@malpern malpern commented May 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add ChordResolved and TapDanceResolved TCP server message variants for KeyPath's Keystroke History feature
  • New chord_tap_dance_tracker keyberon module following the existing tap_hold_tracker pattern (feature-gated, zero-sized no-op when disabled)
  • Advertise chord-resolved and tap-dance-resolved capabilities in HelloOk
  • Emit events in handle_keystate_changes after layout.tick(), with key names, action descriptions, and monotonic timestamps

JSON format

{"ChordResolved":{"keys":"s+d","action":"escape","t":12345}}
{"TapDanceResolved":{"key":"q","tap_count":2,"action":"lalt+tab","t":12345}}

Test plan

  • cargo build --release --target aarch64-apple-darwin succeeds
  • cargo test -p kanata-tcp-protocol — 13 tests pass (2 new)
  • cargo test -p kanata-keyberon — 88 tests pass, existing chord/tap-dance tests unaffected
  • Manual verification with KeyPath overlay sidebar

malpern and others added 7 commits May 21, 2026 19:52
Adds a new repeat engine that lets kanata generate key repeats instead of
relying on the OS. This solves the macOS duplicate key bug where tap-hold
processing delays cause unintended OS autorepeat through the HID report model.

- defcfg options: managed-repeat, managed-repeat-delay, managed-repeat-interval
- defrepeat block for per-key delay/interval overrides
- Automatically suppresses OS hardware repeat when enabled
- Modifiers are exempt from repeat
- Validated on real macOS hardware through Karabiner DriverKit virtual HID
- 9 simulation tests covering basic repeat, per-key overrides, modifiers,
  layer-while-held, and disabled-by-default behavior

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The previous approach re-posted the same HID report, which left macOS
free to run its own repeat timer alongside kanata's managed repeat.

Now the repeat timer has three phases:
1. HeldBeforeRelease (5ms) — key in report just long enough for initial char
2. ReleasedWaiting — key removed from report, OS repeat can never fire
3. Repeating — release+re-press cycles produce fresh keydown events

Validated on macOS hardware under CPU load (KeyPath compile loop).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The reload path was missing the managed_repeat_state and
allow_hardware_repeat updates, so TCP Reload didn't pick up
changes to defrepeat or managed-repeat-delay/interval.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Broadcast chord and tap-dance resolution over TCP for KeyPath's
Keystroke History feature. Follows the existing HoldActivated/
TapActivated pattern with a new chord_tap_dance_tracker module.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@malpern
malpern force-pushed the worktree-chord-tap-dance-tcp branch from db23718 to a5128a0 Compare May 22, 2026 02:52
@malpern
malpern merged commit 8324fd8 into main May 22, 2026
@malpern
malpern deleted the worktree-chord-tap-dance-tcp branch May 22, 2026 05:05
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.

1 participant