Skip to content

feat(mac): hide Dock icon while the main window is hidden - #193

Open
MylesShannon wants to merge 3 commits into
NVIDIA:developfrom
MylesShannon:feat/macos-hide-dock
Open

MylesShannon wants to merge 3 commits into
NVIDIA:developfrom
MylesShannon:feat/macos-hide-dock

Conversation

@MylesShannon

@MylesShannon MylesShannon commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Changelog title

Hide the macOS Dock icon while PAIR runs in the background

Changelog body

  • Add an opt-in setting to hide the Dock icon while the main window is hidden or closed and restore it when reopened.

Bumps

  • services: minor
  • nvpair-cluster-manager: none
  • nvpair-engine-manager: none
  • nvpair-errors: none
  • nvpair-job-scheduler: none
  • nvpair-manual-nodes: none
  • nvpair-node-info: none
  • nvpair-node-scanner: none
  • nvpair-node-settings: none
  • nvpair-proxy: none
  • nvpair-tui: none
  • nvpair-ui-broker: none
  • nvpair-workload-manager: none

Description

Add Settings → Service → Appearance → Hide Dock icon when the window is hidden on macOS. It defaults off, persists locally, and takes effect immediately. Opening Overview restores the Dock icon; opening only the menu bar popup leaves it hidden.

Minimizing the main window keeps the Dock icon visible. A login launch with Start minimized to tray enabled applies the Dock preference after tray initialization, even when no Overview window exists.

Scope

Uses the existing Kaizen UI Switch without custom styling, typed preload/IPC, and local UI configuration. Handles Electron's cooldown after showing the Dock and native application Hide behavior. Windows and Linux behavior is unchanged. Independent of the menu icon and helper-signing changes.

This setting uses Electron's macOS-only app.dock API. Linux taskbar behavior is a separate platform concern and has not been implemented or tested here. The setting remains separate from the startup preferences merged in #97 and the menu bar icon merged in #194.

Validation

  • Linux, Node.js 26.13.0, fresh locked dependencies: make -o desktop/package-lock.json check and npm --prefix desktop run dead-code:check pass, including lint, TypeScript, contracts, build-script and SPDX checks. The Makefile lockfile prerequisite was skipped because npm ci had already completed.
  • The minimized-window regression failed before the review fix and passed afterward. Additional tests cover closing a minimized window and applying the preference with no Overview window, both enabled and disabled.
  • git diff --check passes.
  • Prior native testing on an Apple Silicon Mac covered hide, close, reopen, rapid transitions, menu popup activation, application Hide, disabling the preference, and persistence across a fresh process.
  • The original feature was manually tested in a combined development app on my Mac. The November 24 minimized-window and hidden-startup changes were validated with Electron mocks on Linux; native macOS and login-session testing has not been repeated for this update.

Risk

macOS Dock visibility changes application activation behavior. Deferred hiding rechecks current window/preference state and is canceled on reopening. The preference defaults off for existing configurations. No routing, Go service, or privileged-helper behavior changes.

Checklist

  • I have read the Contributing Guidelines.
  • Every commit is signed off (git commit -s), certifying the Developer Certificate of Origin.
  • Relevant automated or manual checks cover the change, as recorded above.
  • Relevant documentation is updated.
  • I checked the diff, changed filenames, and commit messages for credentials, private data, internal URLs, internal issue identifiers, and generated artifacts.
  • I recorded validation commands and results above, including outstanding checks.
  • I declared version bumps in the release-intent block. No Go service implementation changes; all component bumps are none. Version files and changelog are left to automation.

Signed-off-by: Myles Shannon <github@mylesshannon.com>

@Noah-Tervalon-Nvidia Noah-Tervalon-Nvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overall looks great. Is there a reason you didn't add this support for linux?

Comment thread desktop/src/electron/window.ts Outdated
}

export const refreshDockVisibility = createDockVisibilityController(
() => getOverviewWindow()?.isVisible() ?? false

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

when you minimize a window isVisible becomes false, so then the dock icon goes away which makes it hard to open the app again if you meant to just pop it into your icon bar. We should watch for the window being minimized and not get rid of the bar icon when it is minimized rather than closed.

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.

I’ve updated this so minimizing keeps the Dock icon, while closing or hiding the window removes it when the setting is enabled. It also applies on a hidden login launch. I kept this macOS-only because it uses Electron’s app.dock API. Added regression tests and resolved the merge conflict. Local checks pass, but I haven’t repeated the native Mac test yet.

@timfallmk

Copy link
Copy Markdown

Thanks for this — it fills a gap I ran into with the Startup switches from #97.

On macOS, a login launch with Start minimized to tray on creates no window, but the Dock icon still shows, so PAIR doesn't feel like a menu bar app at sign-in. With this setting on, that launch should start with no Dock icon, which is what I was after.

One question: does the Dock icon get hidden at startup when no window has been created yet (the hidden login launch path in main.ts), or only after a window is hidden or closed? If it's the latter, a hidden login launch would still show the Dock icon until the window is opened and closed once. It may be worth applying the preference right after startup decides the launch is hidden.

Happy to test on a Mac if that helps.

Signed-off-by: Myles Shannon <github@mylesshannon.com>
…ference

Signed-off-by: Myles Shannon <github@mylesshannon.com>
@MylesShannon

Copy link
Copy Markdown
Contributor Author

Thanks for this — it fills a gap I ran into with the Startup switches from #97.

On macOS, a login launch with Start minimized to tray on creates no window, but the Dock icon still shows, so PAIR doesn't feel like a menu bar app at sign-in. With this setting on, that launch should start with no Dock icon, which is what I was after.

One question: does the Dock icon get hidden at startup when no window has been created yet (the hidden login launch path in main.ts), or only after a window is hidden or closed? If it's the latter, a hidden login launch would still show the Dock icon until the window is opened and closed once. It may be worth applying the preference right after startup decides the launch is hidden.

Happy to test on a Mac if that helps.

Thanks for catching this. I’ve updated it to apply the Dock setting on a hidden login launch, even when no window has been created. Automated tests pass, but I haven’t tested that login flow on my Mac yet. I’d appreciate you trying it.

@timfallmk

timfallmk commented Nov 25, 2026 •

Copy link
Copy Markdown

Tested on macOS 27.2 (arm64) at 90aaf19. I took the hidden-launch path unpackaged, via electron . --hidden with startHidden: true — the same shouldStartHidden branch a login launch takes, since the detection itself is unchanged in this PR.

With the preference on, a hidden launch comes up with no Dock icon and no window ever created: activation policy is Accessory (lsappinfo type="UIElement", System Events background only = true) from the first sample onward, the tray initializes fine, and the Dock controller logs no errors. Matrix:

config argv Dock tile Window
hide Dock on, start hidden on --hidden gone never created
hide Dock off, start hidden on --hidden stays never created
hide Dock on, start hidden on — stays created
hide Dock on, start hidden off --hidden stays created

Row 2 reproduces the gap I originally described, which is what makes row 1 meaningful. Row 4 confirms shouldStartHidden still short-circuits when "start minimized to tray" is off. No stray service processes after quitting in any case.

Two caveats on what this does and doesn't cover:

  • It exercises the hidden-launch branch via argv rather than a real sign-in, so macOS's own wasOpenedAtLogin signal is untested here. That code is unchanged by this PR (it shipped in desktop: launch at login and start minimized to the tray (Settings › Service › Startup) #97), and a dev build never registers a login item, so an unpackaged run can't produce it.
  • I can't rule out a brief Dock-tile flash at startup before the hide lands — my first sample was well after launch.

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