Skip to content

Tap the hotkey to toggle dictation - #11

Merged
TerrifiedBug merged 1 commit into
mainfrom
feat/tap-to-toggle-dictation
Aug 21, 2026
Merged

Tap the hotkey to toggle dictation#11
TerrifiedBug merged 1 commit into
mainfrom
feat/tap-to-toggle-dictation

Conversation

@TerrifiedBug

Copy link
Copy Markdown
Owner

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.

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 dictating went false under it, the new capture ran on with no release to stop it. Presses now carry a generation and finishDictation only cleans up for its own.

Verification

Run in the foreground against synthesized fn flagsChanged events (real event tap, real mic, real model):

scenario result
default config, 1.04 s hold ● dictating / ○ captured 0.79s / → 63ms — baseline unchanged
default config, 186 ms tap ○ captured 0.09s — a tap does not latch in hold mode
tap_to_toggle saved while running config reloaded, menu line reads idle · tap fn to dictate
toggle mode, tap … 1.7 s … tap one ● dictating, one ○ captured 1.80s spanning both taps, pill up and state ● listening with the key released
toggle mode, 975 ms hold ○ captured 0.90s on release — push-to-talk preserved
race: third press 36 ms into the second press's transcription ● dictating logged before the older press's → 71ms, pill still on screen, and the next tap's ○ captured 0.79s matches only the third press's window
tap_to_toggle set back to false mid-latch still ● listening; one press stops it (○ captured 1.88s)

Numbers

yap bench --audio on LibriSpeech clips, M4, p50 of 7, parakeet-tdt-ctc-110m, before/after:

clip before after
2 s 34 ms 36 ms
5 s 43 ms 40 ms
10 s 49 ms 51 ms
20 s 75 ms 76 ms

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 one Date() comparison.

`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.
@TerrifiedBug
TerrifiedBug merged commit f07227f into main Aug 21, 2026
1 check passed
@TerrifiedBug
TerrifiedBug deleted the feat/tap-to-toggle-dictation branch August 21, 2026 16:47
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