Skip to content

fix: Dictation text not inserted into the active app#175

Open
UmairSharif wants to merge 1 commit intoaltic-dev:mainfrom
UmairSharif:fix/dictation-text-not-inserted-into-active-app
Open

fix: Dictation text not inserted into the active app#175
UmairSharif wants to merge 1 commit intoaltic-dev:mainfrom
UmairSharif:fix/dictation-text-not-inserted-into-active-app

Conversation

@UmairSharif
Copy link

Description

Fixes silent text insertion failure when concluding a dictation session. Transcribed text appeared correctly in the overlay but was never inserted into the active application.

The root cause was in TypingService.insertTextBulkInstant — it sent text via
CGEvent.keyboardSetUnicodeString posted to the target PID, which silently fails for
Electron-based apps (VS Code, Slack, Notion) and web text fields (Chrome, Safari) because
these apps do not route raw unicode CGEvents through their text input pipeline. The function
always returned true regardless of delivery success, so all fallback methods (Accessibility
API, clipboard paste) were never reached — text was silently dropped.

Fix adds insertTextViaClipboardToPid which posts a Cmd+V key event directly to the target
process PID via postToPid. This is universally handled across all app types. The previous
unicode key-event method is kept as a secondary fallback. Clipboard contents are saved before
and restored after insertion.

Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update

Related Issues

Closes #174

Testing

  • Tested on Intel/Apple Silicon Mac
  • Tested on Apple Silicon Mac
  • Tested on macOS [version]
  • Ran linter locally: brew install swiftlint && swiftlint --strict --config .swiftlint.yml
  • Ran formatter locally: brew install swiftformat && swiftformat --config .swiftformat Sources

Screenshots / Video

Screen.Recording.2026-02-20.at.3.20.03.PM.mov

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.

[🐞 BUG] Dictation text not inserted into active app after concluding recording

1 participant