Mouse-button push-to-talk (opt-in) - #13
Merged
Merged
Conversation
…button Adds an optional mouse button to GlobalShortcutBackend's CGEvent tap (otherMouseDown/otherMouseUp in the tap mask only when configured) with a consume decision callback, plumbs it through HotkeyManager.start, and adds MouseDictationButton with the bindability rules (middle button and above; left/right never) plus 1-based display labels.
New settings mouse_dictation_enabled (default off) and mouse_dictation_button (default 3, the 4th button) following the standard storage-key/@Published-didSet/init-load pattern; both restart hotkey monitoring, which reinstalls the event tap idempotently. Button-down starts a hold session through handleShortcutEvent exactly like the keyboard path, button-up stops it, and the tap consumes both events so the click never reaches the target app. Downs are ignored while a keyboard-triggered session or transcription is active, and every session-ending path clears mouse ownership so a stale flag can never stop a later keyboard session.
New settings card with the enable toggle and a MouseDictationButtonRow
that shows the bound button ("Middle Button" / "Button N") and rebinds
via a local otherMouseDown monitor while capture is armed. The row is
disabled and dimmed while the feature is off, capture suspends the global
tap so the bound button cannot trigger dictation mid-rebind, and left or
right presses are rejected.
Bindability (left/right never, middle and side buttons yes), 1-based display labels, stored-value normalization, and the button-4 default. Registered in the hand-rolled runner and in both Makefile TEST_RUNNER file lists.
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.
Bind a non-primary mouse button as a hold-to-talk trigger (off by default).
.otherMouseDown/Uponly when enabled — zero overhead when off), so the bound click is actually consumed and never reaches the app under the cursor; down/up consumption stays paired..holdActivated/.holdDeactivatedinto the existing keyboard funnel — no parallel dictation path; ignored while a keyboard session or transcription is active; consume decision is cheap/synchronous inside the tap, session work deferred to the main queue (watchdog-safe).mouse_dictation_enabled/mouse_dictation_button.Verified on macOS 26.5 (arm64):
make testpasses, full build clean. Manual QA checklist in comments below is worth running — event taps can't be unit-tested.Conflicts: touches
GlobalShortcutBackend/HotkeyManageralongside #rebindable-cancel.All eight feature PRs register tests in
Tests/AppContextServiceTests.swiftand some extend the Makefile test list, so each merge after the first needs a trivial conflict resolution there. Suggested merge order: dictionary-ranking → formality-dial → caret-context → transforms → scratch-that → raw-undo → rebindable-cancel → mouse-ptt.