fix(setDockIcon): use setActivationPolicy('accessory') for reliable Dock-hiding on Tahoe + previous macOS#802
Open
Austin519 wants to merge 1 commit into
Conversation
….dock.hide() The previous implementation calls app.dock.hide() followed by app.show() which is unreliable in two ways: 1. app.show() focuses the app, which has the side effect of re-promoting the application to the Dock — defeating the purpose of dock.hide(). 2. app.dock.hide() does not survive BrowserWindow creation. Even when called before any windows exist, subsequent window-creation calls re-promote the app to the Dock. The second call site in initServerComponents() doesn't reliably catch this on every macOS version. 3. On macOS 26 (Tahoe), app.dock.hide() does not take effect at all — neither from startup config-load nor from the in-app UI toggle. Verified 2026-05-22 on Tahoe 26.4.1 build 25E253 with BB v1.9.9. app.setActivationPolicy() is the proper Electron API for 'hide from Dock + hide from app switcher + run as background-only app'. It is the runtime equivalent of LSUIElement=true in Info.plist (which would require recompiling the .app with a different bundle config). It survives window creation and works on macOS 26. No behavior change for users with hide_dock_icon=false (default). Tested on macOS 26.4.1 Tahoe + Apple Silicon (M2).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The current
setDockIcon()implementation callsapp.dock.hide()followed byapp.show()whenhide_dock_icon=true. This is unreliable in several ways, and on macOS 26 (Tahoe) it does not work at all.This PR replaces both calls with
app.setActivationPolicy('accessory'|'regular')— the proper Electron API for "background-only app, no Dock presence, no app-switcher presence." It is the runtime equivalent ofLSUIElement=truein Info.plist.Why the current implementation breaks
app.show()re-promotes to Dock.app.show()focuses the application, which on macOS has the side effect of re-activating the Dock icon. The very next line afterapp.dock.hide()undoes the hide.app.dock.hide()doesn't surviveBrowserWindowcreation. Even when called before any window exists, subsequent window-creation calls re-promote the app to the Dock. The secondarysetDockIcon()call ininitServerComponents()doesn't reliably catch this.On macOS 26 (Tahoe),
app.dock.hide()is a no-op. Verified 2026-05-22 on Tahoe 26.4.1 build 25E253 with BB v1.9.9 + Electron's bundled version. The Dock icon stays visible:hide_dock_icon=1in config — Dock icon staysFix
setActivationPolicy('accessory')tells macOS at the AppKit layer that this is an accessory app — no Dock, no app-switcher entry, no menu bar. It survives window creation cycles and works on every macOS version that supports the API (10.6+).setActivationPolicy('regular')restores the default — the equivalent of the previousapp.dock.show()path.Compatibility
hide_dock_icon=false(the default).hide_dock_icon=truewere silently getting no effect on Tahoe; this fixes that.Test plan
Happy to iterate or split into smaller commits if preferred.