Skip to content

Add a send key that presses Return after the paste - #20

Merged
dinooo13 merged 2 commits into
mainfrom
submit-key
Sep 12, 2026
Merged

dinooo13 merged 2 commits into
mainfrom
submit-key

Conversation

@dinooo13

Copy link
Copy Markdown
Owner

What

Press a second chord, Right Option by default, at any point while the push-to-talk key is held, and Return follows the pasted text. That sends a chat message or runs a terminal command without a second trip to the keyboard. The send key is recorded in Settings like the push-to-talk key. An empty chord in settings.json turns it off.

Behaviour

  • The send press latches for the rest of the recording, so the release order of the two keys does not matter. The latch resets on the next press.
  • The send key is swallowed only while the push-to-talk chord is engaged, so an app never sees a stray Cmd+Return mid-dictation. When the chord is not engaged, the key passes through untouched.
  • The 120 s watchdog release never submits: a lost key-up must not send a message unattended.
  • Short taps, cancelled recordings and empty transcripts paste nothing and press nothing.
  • Settings warn when the send key is part of the push-to-talk chord, since it could never be pressed separately.

Where

  • HotkeyChordTracker gains submitKey and isSubmitArmed; HotkeyEvent.released carries submit: Bool.
  • DictationCoordinator threads the flag from the release into TextOutput.insert(_:submit:).
  • PasteboardOutput posts Return from a detached task 50 ms after Cmd+V, with no modifier flags, so it stays off the release-to-paste path and a still-held Option cannot turn it into Option+Return.
  • Settings.submitKey, a second recorder row in Settings, README FAQ and the CLAUDE.md decisions table.

Benchmark

Skipped on purpose. The change threads a flag through finish and insert and the engine call is untouched; the benchmark only times engine.transcribe, so it could not show a difference. A real dictation on this branch logged release-to-paste 0.288 s for 9.9 s of audio with engine 0.212 s, in line with the M1 baseline.

Tests

swift test: 84 tests pass, including 10 new tracker tests and 5 new coordinator tests. Verified live with Fn as the push-to-talk key and Left Control as the send key.

Implementation was drafted by OpenCode running GLM 5.3 Flash from a written spec and reviewed by hand.

🤖 Generated with Claude Code

dinooo13 and others added 2 commits September 12, 2026 23:26
Press a second chord, Right Option by default, at any point while the
push-to-talk key is held and Return follows the pasted text, so a chat
message is sent or a command runs without a second trip to the keyboard.
The send key is recorded in Settings like the push-to-talk key; an empty
chord in settings.json turns it off.

The press latches for the rest of the recording, so release order does
not matter. The send key is swallowed only while the chord is engaged
and passes through otherwise. The watchdog release never submits, and
short, cancelled or empty dictations press nothing. The Return is posted
from a detached task 50 ms after Cmd+V, off the release-to-paste path.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@dinooo13
dinooo13 merged commit 3ec20ea into main Sep 12, 2026
1 check passed
@dinooo13
dinooo13 deleted the submit-key branch September 12, 2026 21:33
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