Skip to content

fix: prevent settings window flash when whisper overlay opens#446

Merged
shobhit99 merged 3 commits into
SuperCmdLabs:mainfrom
monotykamary:fix/whisper-settings-flash
May 29, 2026
Merged

fix: prevent settings window flash when whisper overlay opens#446
shobhit99 merged 3 commits into
SuperCmdLabs:mainfrom
monotykamary:fix/whisper-settings-flash

Conversation

@monotykamary
Copy link
Copy Markdown
Contributor

@monotykamary monotykamary commented May 26, 2026

Problem

When the settings window (or canvas/extension-store window) was previously opened, pressing the whisper hotkey causes a brief flash of the settings window before the whisper overlay appears.

Root Cause

When openSettingsWindow() is called, it switches the SuperCmd app to macOS "regular" activation mode (setMacActivationPolicy("regular")), which makes the app appear in the Dock and Cmd+Tab.

When the whisper hotkey is pressed, the renderer calls window.open() to create the detached whisper popup. Electron intercepts this via setWindowOpenHandler and creates a new BrowserWindow with show: true. On macOS, show: true calls makeKeyAndOrderFront: which activates the application, raising all existing app windows to the foreground — including the settings window. The user sees the settings window flash into view before the alwaysOnTop: true whisper popup renders on top.

Fix

Change the whisper popup creation to use show: false and then call showInactive() after setting up setIgnoreMouseEvents(true) in the did-create-window handler.

showInactive() maps to NSWindow orderFrontRegardless: on macOS, which orders the window in front without making it key or activating the application. This prevents macOS from raising the settings window when the whisper popup appears.

This approach:

  • Adds zero delay — no window hiding/showing, no activation policy switches
  • Does not restore the settings window after whisper closes (the user did not ask for it)
  • Is minimally invasive — only 9 lines changed, no new state variables

Changes

  • src/main/main.ts:
    • In setWindowOpenHandler: changed show: true to show: detachedPopupName !== DETACHED_WHISPER_WINDOW_NAME so the whisper popup is created hidden
    • In did-create-window: added childWindow.showInactive() after setIgnoreMouseEvents(true) for the whisper popup, showing it without activating the app

Testing

  1. Open SuperCmd settings (Cmd+, or from menu)
  2. Switch to another app (e.g. TextEdit)
  3. Press the whisper hotkey
  4. Before fix: settings window flashes briefly before the whisper overlay appears
  5. After fix: whisper overlay appears cleanly with no settings window flash and no added delay

@monotykamary monotykamary marked this pull request as draft May 26, 2026 02:42
When the settings (or canvas/extension-store) window was previously
opened, the app is in macOS regular activation mode. Creating the
detached whisper popup via window.open() with show:true activates
the app on macOS, raising all existing windows to the foreground and
causing a visible flash of the settings window before the alwaysOnTop
whisper popup renders.

Fix by creating the whisper popup hidden (show:false) and then calling
showInactive() after setting up ignore-mouse-events in did-create-window.
showInactive() maps to NSWindow orderFrontRegardless: on macOS, which
orders the window in front without making it key or activating the
application — preventing the settings window from being raised.
@monotykamary monotykamary force-pushed the fix/whisper-settings-flash branch from 890014d to 9f93467 Compare May 26, 2026 02:51
@monotykamary monotykamary marked this pull request as ready for review May 26, 2026 03:15
@shobhit99
Copy link
Copy Markdown
Contributor

@monotykamary can you resolve the conflicts

@monotykamary
Copy link
Copy Markdown
Contributor Author

oh just noticed, gimme a hot min 🚐

@monotykamary
Copy link
Copy Markdown
Contributor Author

@shobhit99 all good 🫡
it kind of merged seamlessly actually, not sure why there were conflict markers 🤔

@shobhit99 shobhit99 merged commit 8513aff into SuperCmdLabs:main May 29, 2026
1 check failed
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.

3 participants