feat: hold-or-double-tap mode for the push-to-talk shortcut - #1878
Open
ljden wants to merge 1 commit into
Open
Conversation
Adds an opt-in double_tap_toggle setting: with push-to-talk on, holding the transcribe shortcut still works as push-to-talk, while a double-tap starts an ongoing session ended by the next press. A lone tap discards its recording instead of transcribing a fraction of a second of audio, so grazing the key is a no-op. Recording starts on key-down either way; the hold-vs-tap decision happens at release, from the press duration. Every release is still deferred by the existing RELEASE_GRACE so X11 auto-repeat cannot misclassify a held key as a tap, and a lone tap's recording is discarded through the existing cancel path when the second-tap window elapses. The coordinator's input events now carry an InputMode (toggle / push-to-talk / hold-or-double-tap) instead of a push_to_talk bool. Double-tap-toggle only modifies how the push-to-talk shortcut behaves, so its switch is shown only while push-to-talk is on. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
My preference would be a short delay, to see if it's a key down/up or a key down to decide if it's toggle or PTT |
2 tasks
Author
@adamkdean I'm curious to hear why you prefer a short tap over a double tap? My motivation was that I wanted to prevent accidentally triggering the toggle state. Particularly when you map a single modifier key like the right command/super/alt/option key, accidental triggers are likely. |
|
My preference has been through experience using this exact mechanism with
Wispr Flow and others over the last year or so.
It works so well that double tapping isn’t necessary imo. But: why not
allow that option?
…On Sun, 9 Aug 2026 at 10:54, Luke Dennis ***@***.***> wrote:
*ljden* left a comment (cjpais/Handy#1878)
<#1878 (comment)>
My preference would be a short delay, to see if it's a key down/up or a
key down to decide if it's toggle or PTT
@adamkdean <https://github.com/adamkdean> I'm curious to hear why you
prefer a short tap over a double tap?
My motivation was that I wanted to prevent accidentally triggering the
toggle state. Particularly when you map a single modifier key like the
right command/super/alt/option key, accidental triggers are likely.
—
Reply to this email directly, view it on GitHub
<#1878?email_source=notifications&email_token=AAMQIZ57OZXCRT6YA7WTGHT5JBC4NA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMRTGA4DSNZUGE3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5230897416>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMQIZ4CFAUPJ6UMTC6Z3BD5JBC4NAVCNFSNUABFKJSXA33TNF2G64TZHM4TGMJYHA4DMOJUHNEXG43VMU5TKMBZG4YTSMZWHA32C5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AAMQIZ4U3PZ4ELC3RWA3IVL5JBC4NA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMRTGA4DSNZUGE3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/AAMQIZ5JIZNNOQCWR67F5P35JBC4NA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMRTGA4DSNZUGE3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
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.
Human Written Description
Optional extension for Push To Talk where a double tap of the Transcribe Shortcut functions as a toggle. Useful for sometimes recording a short transcript and sometimes for recording a longer session. This is based on input from other users such as on #147.
This is an alternative approach to the one I took in #1877 - happy to go with either (or neither if it's not the time). I think I like this one better, but the other one is ok.
Related Issues/Discussions
Related to #147. This implements the behavior described there — a brief press
toggles, press-and-hold is push-to-talk — as an opt-in setting, refined to
require a double-tap to start a session so that an accidental key press
is a no-op instead of an open microphone.
With the "Double-Tap To Toggle" switch enabled (shown only while Push To Talk
is on, off by default):
nothing is transcribed or pasted, even if the tap caught real speech
Recording starts on key-down in all cases; classification happens at release
from the press duration, so no gesture adds latency. Every release still goes
through the existing
RELEASE_GRACEdeferral, so X11 auto-repeat can'tmisclassify a held key as a tap (#1539's scenario). The coordinator's input
events now carry an
InputModeenum (toggle / push-to-talk /hold-or-double-tap) instead of a
push_to_talkbool; signal/CLI triggers areunchanged (always toggle).
Design notes:
PTT (the handler derives the mode from
push_to_talkfirst) and appliesagain when PTT returns.
DEBOUNCE/RELEASE_GRACE:HOLD_THRESHOLD300 ms (hold vs tap) andSECOND_TAP_WINDOW150 ms (lonevs double tap, measured from the tap's release). Deliberately constants,
not settings — happy to expose them if there's demand. One consequence:
a push-to-talk recording shorter than 300 ms is treated as a tap and
discarded, which is the accidental-press protection working as intended.
(separate always-toggle binding). The two are independent and composable —
happy to go with either or both, whichever fits the project's direction.
see feat: add opt-in always-toggle shortcut alongside push-to-talk #1877
Community Feedback
In #147, @cjpais described this behavior as "a good default behavior" and
noted the code at the time wouldn't support it well — the coordinator added
since then (serialized input events with deadline-based deferral) turned out
to support it cleanly. @retspen, @codepunkt and @samleibowitz expressed
interest in a toggle mode coexisting with push-to-talk.
Testing
cargo test: 183 passed — includes 6 new deterministic tests for thehold-or-double-tap state machine (hold, lone-tap discard, double-tap lock,
locked-session behavior, X11 auto-repeat absorption, hold duration measured
from the initial press), driven by a synthetic-clock simulator mirroring the
coordinator loop, in the same style as the existing PTT regression tests
cargo check,cargo clippy,cargo fmt --checkclean (no new warnings)bun run lint,tsc,prettier --check,vite buildall pass#[serde(default)], no migration neededbun run tauri dev): hold/double-tap/lone-tap all behaveas described; PTT off→on cycle keeps the switch state consistent
Screenshots/Videos (if applicable)
AI Assistance
If AI was used:
human direction; design decisions (double-tap vs single-tap, opt-in scoping,
timing values) made by the human, who reviewed the diff, ran all checks, and
manually tested the feature