Skip to content

Fix whisper dictation closing launcher when triggered from within SuperCmd (fixes #251)#292

Open
shobhit99 wants to merge 2 commits into
mainfrom
fix/issue-251-dictation-button
Open

Fix whisper dictation closing launcher when triggered from within SuperCmd (fixes #251)#292
shobhit99 wants to merge 2 commits into
mainfrom
fix/issue-251-dictation-button

Conversation

@shobhit99
Copy link
Copy Markdown
Contributor

Summary

  • When Whisper dictation was triggered while the SuperCmd launcher was visible, the transcribed text was being routed to the previously frontmost external app via activateLastFrontmostApp() — switching focus away from SuperCmd and effectively closing it
  • This affected the search bar, notes, canvas, and any other SuperCmd screen

Root cause

whisper-type-text-live IPC handler always called activateLastFrontmostApp() before typing, regardless of whether the launcher was open. When launched from within SuperCmd, this switched focus to a different app.

Fix

  • In main.ts: if the launcher window is currently visible when whisper-type-text-live is called, send a whisper-insert-into-launcher event directly to the renderer instead of activating another app
  • In preload.ts + electron.d.ts: expose onWhisperInsertIntoLauncher bridge
  • In App.tsx: listen for whisper-insert-into-launcher and insert the transcribed text at the current cursor position using document.execCommand('insertText'), which works for the search bar, notes, canvas, and any focused contenteditable

Test plan

  • Open SuperCmd, trigger Whisper dictation — launcher should stay open and text should appear in the search bar
  • Open Notes in SuperCmd, trigger dictation — text should be inserted into the notes editor
  • Open Canvas, trigger dictation — text should be inserted at cursor
  • When SuperCmd is hidden and dictation is triggered via global hotkey, text should still go to the previously active external app (existing behavior unchanged)

Closes #251

🤖 Generated with Claude Code

shobhit99 and others added 2 commits April 20, 2026 13:27
Adds a microphone icon button to the launcher search header that triggers
the existing Whisper STT system. The button turns red while dictation is
active and is only shown when AI is enabled.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…erCmd (fixes #251)

When Whisper dictation was triggered while the SuperCmd launcher was
visible, the transcribed text was being routed to the previously
frontmost external app via activateLastFrontmostApp(), which switched
focus away from SuperCmd and effectively closed it.

Fix: in whisper-type-text-live, if the launcher is currently visible,
skip app-switching entirely and instead send a whisper-insert-into-launcher
IPC event directly to the renderer. The renderer inserts the transcribed
text at the current cursor position using document.execCommand('insertText'),
which works for the search bar, notes, canvas, and any other focused input.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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] Allow dictation in SuperCmd Itself

1 participant