Skip to content

feat(settings): add "Keep window open when it loses focus" option#2875

Merged
setchy merged 2 commits intogitify-app:mainfrom
BlueManCZ:keep-window-on-blur
May 11, 2026
Merged

feat(settings): add "Keep window open when it loses focus" option#2875
setchy merged 2 commits intogitify-app:mainfrom
BlueManCZ:keep-window-on-blur

Conversation

@BlueManCZ
Copy link
Copy Markdown
Contributor

@BlueManCZ BlueManCZ commented May 10, 2026

Summary

Adds an opt-in "Keep window open when it loses focus" checkbox to System settings (default off). When enabled, the Gitify popup stays visible after focus moves to another window — useful when triaging notifications side-by-side with the browser, an editor, or a chat client.

Why

By default, Electron menubar apps hide the popup as soon as it loses focus (the menubar library's blur-driven hide). That matches the glance-and-go menubar convention but actively gets in the way of side-by-side workflows: read a PR in the browser while keeping the notification list visible, drag-and-drop URLs into another tool, etc. On tiling WMs (Hyprland, i3, Sway) where there's no fixed "menubar" zone, the convention itself feels out of place.

The setting is off by default, preserving existing behavior.

Where it lives

At the bottom of Settings → System, after the existing checkboxes. One-line tooltip explains the behavior.

Implementation notes for reviewers

  1. The mechanism is purely JS-level. menubar's blur listener short-circuits its own hide when the underlying BrowserWindow.isAlwaysOnTop() returns true (node_modules/menubar/lib/Menubar.js:343-353). We toggle that flag from the renderer-driven setting via a new IPC event (UPDATE_KEEP_WINDOW_ON_BLUR). No window-manager hints or platform-specific paths involved — works uniformly on macOS, Windows, X11, and (verified) Hyprland.

  2. Small bug fix folded in. The existing devtools-opened handler in src/main/lifecycle/window.ts sets alwaysOnTop=true for DevTools usability. The matching devtools-closed handler previously did not restore it, so opening and closing DevTools left the flag stuck on for the rest of the session. The new applyKeepWindowOnBlur setter owns this flag's lifecycle, and the devtools-closed handler now restores it to the user's preference (false by default, matching the prior intent). One line of behavior change, inseparable from owning the flag — calling it out so the diff doesn't look surprising.

  3. Naming across the IPC boundary. Renderer concept: keepWindowOnBlur. Main-side setter: applyKeepWindowOnBlur(mb, value). The fact that we implement it via setAlwaysOnTop is an implementation detail and not exposed in the public name.

Behavior matrix

Setting Click outside window Esc Tray icon click Open DevTools → close DevTools
Off (default) hides popup hides popup toggles flag returns to false ✓ (was previously stuck on)
On popup stays hides popup toggles flag returns to true

Test plan

  • With setting off (default): clicking outside the window hides it — same as main.
  • With setting on: clicking outside leaves the popup visible; Esc still hides it; tray icon click still toggles.
  • Setting persists across app restart.
  • Open DevTools, then close it — alwaysOnTop returns to the setting's current value (regression check on the bug fix above).
  • pnpm test — 1038 tests pass; new tests cover applyKeepWindowOnBlur, devtools-closed restoration, the settings checkbox, and the IPC handler; Settings snapshot regenerated.
  • pnpm check and pnpm tsc --noEmit clean.
  • Manually verified on Hyprland (Wayland). Mechanism is JS-level so other platforms should behave identically — I don't have macOS or Windows to verify locally.

@github-actions github-actions Bot added the enhancement New feature or enhancement to existing functionality label May 10, 2026
@setchy
Copy link
Copy Markdown
Member

setchy commented May 10, 2026

Isn't this already covered by our Open Links system preference...

@BlueManCZ
Copy link
Copy Markdown
Contributor Author

No, it is not. Gitify still closes when the window loses focus, no matter what I set there. This has nothing to do with the links. Does this behave differently on other platforms?

@BlueManCZ
Copy link
Copy Markdown
Contributor Author

BlueManCZ commented May 10, 2026

Just to show what I mean. Note that I'm using only mouse and the focus follows the cursor.

2026-05-10.21-36-02-a.mp4

visible={!window.gitify.platform.isLinux()}
/>

<Checkbox
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please move this above the openAtStartup option

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@setchy
Copy link
Copy Markdown
Member

setchy commented May 10, 2026

Just to show what I mean. Note that I'm using only mouse and the focus follows the cursor.

2026-05-10.21-36-02-a.mp4

Ty

Aside: the window positioning really is proper broken on Linux🤢

@afonsojramos
Copy link
Copy Markdown
Member

the window positioning really is proper broken on Linux🤢

Is that not a hyprland issue specifically?

@BlueManCZ
Copy link
Copy Markdown
Contributor Author

BlueManCZ commented May 11, 2026

the window positioning really is proper broken on Linux🤢

Is that not a hyprland issue specifically?

Yes, this is Hyprland specific. Tried it on Gnome and there it opens correctly near the tray icon.

@setchy setchy merged commit 7085e9d into gitify-app:main May 11, 2026
13 checks passed
@BlueManCZ BlueManCZ deleted the keep-window-on-blur branch May 11, 2026 11:27
@setchy setchy added this to the Release 7.0.0 milestone May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or enhancement to existing functionality

Development

Successfully merging this pull request may close these issues.

3 participants