feat: restore dictation on macOS 26+ via subprocess pynput isolation#174
Draft
feat: restore dictation on macOS 26+ via subprocess pynput isolation#174
Conversation
macOS Tahoe enforces TSM calls on the main dispatch queue, crashing pynput's background-thread CGEventTap. Instead of disabling dictation entirely, spawn a dedicated helper subprocess (_hotkey_helper.py) whose main thread runs the pynput listener — satisfying TSM requirements. The parent process receives semantic events (hotkey_press/release, escape) via JSON-line IPC and retains all recording, double-tap, and hands-free logic. Closes #172 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move duplicated hotkey-matching code (_MODIFIER_MAP, parse_hotkey, normalise_key, key_matches, all_modifiers_held) into a shared _hotkey_shared.py module, imported by both the engine and helper - Update README to reflect that dictation now works on macOS 26+ - Rename test class to TestHotkeySharedModule Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
a753306 to
c8e66da
Compare
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.
Summary
_hotkey_helper.py) whose main thread runs pynput's keyboard listener, satisfying macOS Tahoe's TSM main-dispatch-queue requirementhotkey_press,hotkey_release,escape) to the parent via JSON-line IPC on stdout_hotkey_shared.pyto avoid code duplication between engine and helperTest plan
TestSubprocessHelperEvents— verifies_on_helper_eventcorrectly maps events to recording/hands-free/double-tap logicTestHotkeySharedModule— verifies hotkey parsing, key matching, and modifier tracking in the shared moduleTestEngineLifecycle.test_start_uses_subprocess_on_macos_26— subprocess path used on macOS 26+TestEngineLifecycle.test_start_fails_gracefully_on_macos_26_if_helper_fails— graceful degradationCloses #172
🤖 Generated with Claude Code