Skip to content

feat: bind key chords from the config file - #1

Closed
clvrobj wants to merge 1 commit into
mainfrom
feat/config-key-chords
Closed

clvrobj wants to merge 1 commit into
mainfrom
feat/config-key-chords

Conversation

@clvrobj

@clvrobj clvrobj commented Aug 15, 2026

Copy link
Copy Markdown
Owner

What

Adds a "chords" section to ~/.config/micromanager/config.json, binding a pad key to keys pressed in the focused agent's pane:

{ "chords": { "12": "enter" } }

Why

A text macro composes a prompt but deliberately leaves it unsubmitted, so finishing a dictated line still meant reaching for the keyboard. This closes that loop — dictate into an agent pane, then tap the key to submit.

How

HerdrClient.sendKeys already existed and is used by TuneController to confirm model choices, so this is dispatch plumbing rather than new capability. The chord names are Herdr's, handed to pane.send_keys untouched — "enter", "esc", "ctrl+alt+u", or an array pressed in order.

A chord outranks a text macro on the same key: the text defaults are inherited rather than chosen, so an explicit chord shouldn't have to unbind one first.

Keys 9, 10, 11 and 12 accept chords — the same flexible keys that already take text macros. The key stays KV_OAI_AG*-bound, so it keeps its light and keeps reporting presses; nothing touches the device keymap.

Scope / limitations

  • Chords reach Herdr panes only. They're injected into the pane's pty, so they never become system-wide key events — a chord can't drive a system-wide app like a dictation tool. Host-side CGEvent synthesis (as VoiceController does for right command) would be the upgrade path if that's ever wanted.
  • A mistyped chord name fails at Herdr rather than at config-load time, surfacing via lastError in the panel.

Testing

  • 7 new unit tests in KeyBindingsTests covering the string form, array form, "" unbind, "10+11" expansion, chord-beats-text precedence, and malformed input falling back to defaults.
  • Full suite: 89 tests, 3 skipped. The one failure (LiveDeviceTests.testDeviceKeymapHasTheStackKeyBound) is pre-existing and unrelated — it fails on hardware whose joystick reports type: VENDOR with an empty sectors array.
  • Verified end to end on a Creator Micro 2: key 12 lights steel blue and submits the focused agent's prompt.

🤖 Generated with Claude Code

A text macro composes a prompt but deliberately leaves it unsubmitted, so
finishing a dictated line still meant reaching for the keyboard. A `"chords"`
entry presses keys in the focused agent's pane instead of typing into it, which
is the other half of that gesture: `{"chords": {"12": "enter"}}` makes the
bottom-right key submit.

The names are Herdr's own, handed to `pane.send_keys` untouched, so a chord is
whatever that vocabulary allows — "enter", "esc", "ctrl+alt+u", or an array
pressed in order. A chord outranks a text macro on the same key: the text
defaults are inherited rather than chosen, so an explicit chord should not have
to unbind one first.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@clvrobj

clvrobj commented Aug 15, 2026

Copy link
Copy Markdown
Owner Author

Superseded by the upstream PR: schacon#8

Closing this one to avoid duplication. The branch stays put — the upstream PR uses it as its head.

@clvrobj clvrobj closed this Aug 15, 2026
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