Skip to content

fix: re-hide macos dock icon after parentless dialogs - #3100

Open
afonsojramos wants to merge 2 commits into
mainfrom
fix/macos-dock-icon-after-dialog
Open

fix: re-hide macos dock icon after parentless dialogs#3100
afonsojramos wants to merge 2 commits into
mainfrom
fix/macos-dock-icon-after-dialog

Conversation

@afonsojramos

@afonsojramos afonsojramos commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

Since v7.0.0 the macOS dock icon occasionally reappears even though Gitify runs as a dock-hidden (accessory) app, and only a restart re-hides it.

Investigation

Tested live on macOS by driving the real built app (hidden window, setVisibleOnAllWorkspaces, accessory policy) and measuring app.dock.isVisible():

  • Reproduced: app.dock.hide() can be silently dropped when it races an app activation transition. In the experiment, hide() called 500ms after the dock became visible left the icon showing; a later hide() succeeded. electron-menubar calls dock.hide() very early in startup, so a lost race there leaves the icon stuck for the whole session. A restart re-rolls the race, which matches "occasionally showing" + "restart restores it".
  • Not reproduced (on this machine/OS): the parentless dialogs (updater "restart to install", first-run prompt) did not flip the dock. Kept the dialog-path re-hides anyway as cheap defense, since dialog-driven activation is version-dependent macOS behavior.
  • DevTools (detached) also did not affect the dock.

Fix

  1. Startup re-assert (the evidence-backed part): ~2s after menubar ready, if the dock is visible, call app.dock.hide(). Guarded on isVisible() because dock.hide() also deactivates the app, so it must not run unconditionally near window-show paths (that would steal the popup's focus and trigger the blur auto-hide).
  2. Dialog-close re-hides (defensive): re-assert hidden after the updater dialog is dismissed and after the first-run prompt closes.

Tests

  • startup.test.ts: re-hides when the dock is visible after the delay; leaves it alone when already hidden.
  • updater.test.ts: dismissing the update dialog re-hides the dock.
  • first-run.test.ts: the dock is re-hidden after the prompt closes.

pnpm check, tsc --noEmit, and the affected suites pass (27 tests).

Closes #3069

@afonsojramos
afonsojramos requested a review from setchy as a code owner July 28, 2026 15:09
@github-actions github-actions Bot added the bug Something isn't working label Jul 28, 2026
@sonarqubecloud

Copy link
Copy Markdown

@setchy

setchy commented Jul 28, 2026

Copy link
Copy Markdown
Member

should this logic be within electron-menubar based on this config param being set?

showDockIcon: false, // Hide the app from the macOS dock

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.

macOS: dock icon occasionally showing

2 participants