Skip to content

fix: prevent Windows tray blur→hide race on window show (#3064)#3082

Open
marceli1404 wants to merge 1 commit into
gitify-app:mainfrom
marceli1404:fix/windows-tray-blur-race
Open

fix: prevent Windows tray blur→hide race on window show (#3064)#3082
marceli1404 wants to merge 1 commit into
gitify-app:mainfrom
marceli1404:fix/windows-tray-blur-race

Conversation

@marceli1404

Copy link
Copy Markdown

Problem

Issue #3064: On Windows v7.0.0/v7.0.1, clicking the tray icon produces no visible result. The app runs in background (notifications, colored icon) but the window never appears. Silent failure — no errors in logs.

Root Cause

\�lectron-menubar's internal blur handler hides the window 100ms after it loses focus. On Windows, clicking the tray icon may not transfer focus to the window, causing the blur→hide timeout to fire immediately after \showWindow(). When this timeout fires before the first paint cycle, the user sees no visible result.

Relevant Menubar.ts code:
\\ ypescript
this._browserWindow.on('blur', () => {
if (!this._browserWindow) return;
this._browserWindow.isAlwaysOnTop()
? this.emit('focus-lost')
: (this._blurTimeout = setTimeout(() => {
this.hideWindow();
}, 100));
});
\\

If \�lwaysOnTop\ is true, the blur handler emits \ ocus-lost\ instead of hiding — this is the escape hatch.

Fix

Listen for the \�fter-show\ event and temporarily set \�lwaysOnTop=true\ for 400ms after showing the window. This causes the blur handler to short-circuit via the \ ocus-lost\ path instead of hiding. The user's \keepWindowOnBlur\ preference is restored after the blur race window passes.

Fixes #3064

…3064)

On Windows, clicking the tray icon may not transfer focus to the window,
triggering electron-menubar's internal blur handler which hides the window
after a 100ms timeout. If this timeout fires before the first paint, the
user sees no visible result.

Workaround: listen for 'after-show' and temporarily set alwaysOnTop=true
so the blur handler emits 'focus-lost' instead of hiding. Restore the
user's preference after 400ms.
@github-actions github-actions Bot added the bug Something isn't working label Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Development

Successfully merging this pull request may close these issues.

Unable to open window

1 participant