Tap the hotkey to toggle dictation - #11
Merged
Merged
Conversation
`dictation.tap_to_toggle` makes a tap start recording and a second tap stop it, instead of holding the key down. A press held past half a second still ends on release, so push-to-talk keeps working and the mode never latches the mic open on someone's muscle memory. Config-only and read at the point of use, like the other dictation niceties, so it hot-reloads; the menu bar's idle line and the boot banner say which verb applies. Also fixes a state race the new mode makes easy to hit: a press landing while the previous press's transcription was in flight had its indicator, overlay and capture torn down by that older press's completion, leaving the mic open with no release to stop it. Presses now carry a generation and finishDictation only cleans up for its own. Measured on an M4, p50 of 7 runs, parakeet-tdt-ctc-110m, before/after: 2 s 34/36 ms, 5 s 43/40 ms, 10 s 49/51 ms, 20 s 75/76 ms — noise, as expected from a change that does not touch the transcription path. The press path gains one config read, measured at 25.6 us p50.
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.
dictation.tap_to_togglemakes a tap start recording and a second tap stop it, instead of holding the key down. A press held past half a second still ends on release, so push-to-talk keeps working and the mode never latches the mic open on someone's muscle memory. Config-only and read at the point of use, like the other dictation niceties, so it hot-reloads; the menu bar's idle line and the boot banner say which verb applies.It also fixes a state race the new mode makes easy to hit. A press landing while the previous press's transcription was in flight had its indicator, overlay and capture torn down by that older press's completion — the pill vanished and, because
dictatingwent false under it, the new capture ran on with no release to stop it. Presses now carry a generation andfinishDictationonly cleans up for its own.Verification
Run in the foreground against synthesized
fnflagsChanged events (real event tap, real mic, real model):● dictating/○ captured 0.79s/→ 63ms— baseline unchanged○ captured 0.09s— a tap does not latch in hold modetap_to_togglesaved while runningconfig reloaded, menu line readsidle · tap fn to dictate● dictating, one○ captured 1.80sspanning both taps, pill up and state● listeningwith the key released○ captured 0.90son release — push-to-talk preserved● dictatinglogged before the older press's→ 71ms, pill still on screen, and the next tap's○ captured 0.79smatches only the third press's windowtap_to_toggleset back to false mid-latch● listening; one press stops it (○ captured 1.88s)Numbers
yap bench --audioon LibriSpeech clips, M4, p50 of 7,parakeet-tdt-ctc-110m, before/after:Noise in both directions, as expected from a change that does not touch the transcription path. The key-down path gains exactly one config read — measured at 25.6 µs p50, 71.8 µs p99 against a 60 ms
engine.start()— and the release path gains a stored-bool check and oneDate()comparison.