Paste dictation into the field focused at dictation start#32
Merged
Conversation
Previously the transcript was pasted (Cmd+V) into whatever app/field had keyboard focus when transcription finished, so switching apps or clicking elsewhere while speaking sent the text to the wrong place. AppModel.toggleDictation now snapshots the focused AX element and its owning app pid synchronously at trigger time; TextInjector.inject re-activates that app, raises the element's window, and restores AX focus (with a short settle delay) before sending the paste keystroke. Falls back to the old paste-at-current-focus behavior when no target could be captured, focus was on Heard itself, or the target app has quit. onUtterance is now typed @mainactor since its handler reads main-actor state. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K5HoQZ6SHoLhyn3CGPtPsg
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.
Previously the transcript was pasted (Cmd+V) into whatever app/field had
keyboard focus when transcription finished, so switching apps or clicking
elsewhere while speaking sent the text to the wrong place.
AppModel.toggleDictation now snapshots the focused AX element and its
owning app pid synchronously at trigger time; TextInjector.inject
re-activates that app, raises the element's window, and restores AX focus
(with a short settle delay) before sending the paste keystroke. Falls back
to the old paste-at-current-focus behavior when no target could be
captured, focus was on Heard itself, or the target app has quit.
onUtterance is now typed @mainactor since its handler reads main-actor
state.
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01K5HoQZ6SHoLhyn3CGPtPsg