Skip to content

Hide menu bar icon#63

Open
ryan-saffer wants to merge 1 commit into
gouwsxander:mainfrom
ryan-saffer:hide-menu-bar-icon
Open

Hide menu bar icon#63
ryan-saffer wants to merge 1 commit into
gouwsxander:mainfrom
ryan-saffer:hide-menu-bar-icon

Conversation

@ryan-saffer

@ryan-saffer ryan-saffer commented Jul 1, 2026

Copy link
Copy Markdown

Addresses issue #49

⚠️ Although this PR looks large, it is mostly moving the existing menu/preferences logic onto AppKit primitives (NSStatusItem/explicit Preferences window) so Reef can behave correctly as a no-Dock utility app and truly remove the menu bar item when hidden.

I have tested this extensively myself and everything still works great and all core functionality is unchanged. The only changes are UI related to the menu bar and the preferences window, and lifecycle changes around app launch.

What This Changes

This PR makes Reef behave correctly as a menu-bar/accessory app, including when the menu bar icon is hidden.

  • Cold launches now only start Reef in the background.
  • Subsequent launches while Reef is already running open the Preferences window.
  • The menu bar icon can now be genuinely hidden.
  • Menu bar actions that would otherwise become inaccessible are now available in General Preferences:
    • Check for updates...
    • Quit Reef
    • App version information at the bottom of the window

Because Preferences is a floating window, and this adds a 'Check for updates' button in General Preferences, Sparkle's update UI could appear behind it. The update action now temporarily lowers the Preferences window while Sparkle presents its update windows, then restores Preferences to floating behaviour afterward.

Why The Refactor Was Needed

The previous SwiftUI MenuBarExtra approach could not genuinely hide the menu bar item. Making the icon empty or clear still left an invisible clickable slot in the menu bar, which was incorrect behaviour.

To truly hide the icon, Reef needed to move to an AppKit NSStatusItem, because AppKit lets us remove the status item from NSStatusBar entirely.

The Preferences behaviour also needed to move away from SwiftUI's Settings scene. In an LSUIElement app, the standard Settings scene did not give enough control over cold launch versus hot launch behaviour. Reef now uses an explicit AppKit app entry point and an explicit Preferences window so that:

  • Cold launch starts the app without opening Preferences.
  • Hot launch opens Preferences.
  • Closing Preferences does not quit Reef.
  • Preferences remains available even when the menu bar icon is hidden.

Potential Improvement

If Reef is cold-launched while the Hide menu bar icon preference is enabled, it can feel like nothing happened (it just silently opened in the background). In this case we could open the Preferences window so it's clear the app was launched.

If we did this it would need an exception for launch-at-login, because login startup should remain silent even when the menu bar icon is hidden. (This is possible and I had it working, but wasn't sure which way to go).

this required a rework of how the menu bar was managed.
makes the preferences window the apps main window - launching the app if
its already open will open preferences.
ensured all menu items are in the settings as well so nothing is lost;
check for updates, quit reef and showing app info (version number)
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.

1 participant