Hidden Bar is a single-process, sandboxed AppKit menubar utility (~1.5k lines of
Swift, one dependency: HotKey). There is no
helper app, no daemon, no network. Everything happens inside three
NSStatusItems and one window.
macOS offers no API to hide other apps' menubar icons. Hidden Bar fakes it with geometry: a separator status item whose length is inflated to roughly the width of the widest attached screen, shoving every icon to its left off-screen. Collapsing and expanding is just flipping that length between ~20pt and the inflated value.
flowchart LR
subgraph menubar [menu bar, right to left]
direction RL
ARROW["arrow item\n(toggle, variable length)"]
SEP["separator item\n20pt expanded / ~2x screen width collapsed"]
HIDDEN["other apps' icons\npushed off-screen when collapsed"]
ALWAYS["always-hidden separator\n(optional)"]
end
ARROW --- SEP --- HIDDEN --- ALWAYS
Key consequences of this design:
- The menubar replicates on every display, so the collapse length derives from
the widest screen (
NSScreen.screens), neverNSScreen.main, and is re-applied to the live item ondidChangeScreenParametersNotification(display hot-plug). - The length is bounded:
max(500, min(widestFrameWidth * 2, 10_000)). macOS enforces a hard 10,000pt maximum onNSStatusItem.length. isCollapsedis derived state:separator.length > 20, deliberately not an equality check, so it survives the length being recomputed while collapsed.- Icons macOS inserts to the LEFT of the separator (where new status items appear) are in the hidden zone by default; that is inherent to the trick.
flowchart TD
AD[AppDelegate] -->|owns| SBC[StatusBarController]
AD -->|registers| SM["SMAppService.mainApp\n(login item, macOS 13+)"]
AD -->|global hotkey| HK[HotKey lib]
SBC -->|3 status items| NSB[NSStatusBar.system]
SBC -->|auto-hide| T["one-shot Timer\n(re-arms while pointer in menubar)"]
SBC -->|opt-in| HM["global mouseMoved monitor\n(hover-to-expand, only if pref on)"]
PREFS[Preferences facade] -->|UserDefaults| UD[(UserDefaults)]
PREFS -->|posts| NC{{NotificationCenter\n.prefsChanged / .alwayHideToggle}}
NC --> SBC
PVC[PreferencesViewController] --> PREFS
SBC -->|context menu| PVC
AppDelegate(entry): registers default prefs, sets up the global hotkey, runs the one-shot legacy login-item migration, owns theStatusBarController. Global shortcuts live inHotKeyRegistry(keyed by the preference that stores each one, re-read on.prefsChanged);ShortcutRecorderRowis the one Settings control that records them.StatusBarController(the product, ~370 lines): the three status items, when to collapse/expand, auto-hide timer, interaction-awareness, hover-to-expand, self-restore of dragged-off items.MenuBarEngine(Features/StatusBar/Engine/): how hiding is achieved. The controller callscollapse/expand/updateAlwaysHiddenSection/invalidateLayoutand never writes a status-item length itself.MenuBarEngineFactoryis the one place that picks an engine for the running OS and build:NativeVisibilityEngineon macOS 27 and later in the direct build (HIDDENBAR_NATIVE_VISIBILITY),LegacyLengthEngine(the length trick below) everywhere else, the App Store build on any OS included.ShortcutRecorderRowandHotKeyRegistry(Features/Settings,Models): every global shortcut (expand/collapse, find a hidden icon, presentation mode) is aDatapreference recorded by the oneShortcutRecorderRowand bound by the registry, which re-reads on.prefsChanged. The registry never imports the hot key library;AppDelegatesupplies the Carbon binding. A recorder refuses a combination that is already another Hidden Bar shortcut and names that one.MenuBarItemCatalog(Features/StatusBar/Layout, direct build only): the list of menu-bar apps (bundle id, name, icon, section, first-seen time, running state) built from the engine's unrestricted reads plus the pinned-sections table. It posts.menuBarCatalogChangedand the arrivals of the latest read; macOS's own extras are left out. The pure merge and diff isMenuBarCatalogState. The palette, arrivals and the presentation picker all read from it; none adds a read of its own.Reveal(Features/Reveal): opt-in scroll, empty-click and shake gestures that show the hidden icons.RevealGesturesis the pure recognizer (thresholds inRevealTuning),RevealHitTestertells empty bar from an icon through one Accessibility read at the pointer, andRevealControllerasksStatusBarControllerto expand. Global mouse and scroll monitors only, installed only while a pref is on.Palette(Features/Palette, direct build): the type-to-find panel.PaletteModelandPaletteRankingare pure;PaletteControllerowns the non-activating key panel, so typing needs no key monitor. Return runs aPaletteRevealSession, which mirrors the clock session: it allows one more bundle throughMenuBarEngine.allowTemporarily, presses the icon, and puts the old list back when its menu closes, unless the user changed the bar meanwhile.Arrivals(Features/Arrivals, direct build):ArrivalsInboxis the pure decision (seen set, pending queue, answers, upgrade seeding, 24 hour lapse).ArrivalsControllerappliesnewAppDefaultSectionto each catalog arrival once, throughPinnedSectionEdits.set; Ask Me queues it inarrivalsPending, dots the arrow, and the prompt popover answers.Presentation(Features/Presentation, direct build):PresentationStateis the pure state machine (manual or mirror cause, camera and microphone pause with a 2.5 s quiet period).PresentationControllerowns the capsule status item and the panels;DisplayMirroringreadsCGDisplayIsInMirrorSetfrom the screen-parameters notice. The engine holds one desired list (hold(whenBar:)) and one reconcile (reconcileHold), so a launch, a clock click or a re-activation never swaps the strict list back; a refused list fails open and a crash releases it.Preferences(facade enum): typed accessors overUserDefaults; setters postNotificationCenternotifications that the controller and prefs window observe. There is no other state store.PreferencesWindowController: the only window, built in code with a centered tab control and panes (PreferencesViewControlleris General; Appearance, Advanced and About sit inFeatures/SettingsandFeatures/About), shown on demand from the context menu.SettingsContextcarries the build, OS and status the panes branch on;SettingsModel.swiftholds the AppKit-free decisions.
| Layer | Mechanism | Cost when unused |
|---|---|---|
| Auto-hide | one-shot Timer after expand; at fire, if the pointer sits in any screen's menubar band (visibleFrame.maxY ... frame.maxY), it re-arms instead of collapsing |
none (single point-in-rect check at fire) |
| Hover-to-expand (opt-in) | global .mouseMoved monitor + 0.5s dwell timer; installed while the hoverToExpand default is true (Preferences checkbox; installed or removed on change) |
zero: monitor not installed |
| Self-restore | isVisible = true forced on our items at launch; Cmd-dragging them off otherwise bricks the app (its only UI is those items) |
none |
| Always-hidden section | a second separator item; its own length games, gated by alwaysHiddenSectionEnabled |
item not created |
| Reveal gestures (opt-in) | global scroll and mouse monitors; one Accessibility read at the pointer once a gesture is recognized | zero: no monitor with every reveal pref off |
| Find a hidden icon (opt-in) | one registered global shortcut; a non-activating panel over MenuBarItemCatalog |
zero: no shortcut, no panel |
| Arrivals (opt-in Ask Me) | catalog arrival diff; one pref write per new app | none with Show It or Hide It beyond the write |
| Presentation mode (opt-in) | a strict held list in the native engine, a capsule status item, mirror and capture signals | zero: no capsule while off |
macOS 13+ SMAppService.mainApp: the app registers itself; the login item is
visible and revocable in System Settings > General > Login Items. Builds up to v1.10 registered a com.dwarvesv.LauncherApplication helper instead, and the BTM database never garbage-collects that record (Apple TN3111). SMLoginItemSetEnabled cannot reach it once the helper is gone from the bundle (error 22), so LegacyLoginItem uses the one call that does: unregistering SMAppService.mainApp drops every record under the app. When the old sandbox container exists (or the build is sandboxed) and launch at login is on, it unregisters and re-registers the main app once, then sets smAppServiceMigrated; with launch at login off it waits. The helper app itself is gone.
Sandboxed (com.apple.security.app-sandbox), hardened runtime, no network
entitlement, no file I/O, no IPC surface, no shell or subprocess use. The only
dependency is HotKey (a small Carbon RegisterEventHotKey wrapper) locked by
the committed Package.resolved. The opt-in hover monitor observes pointer
position only and discards event payloads. About-window links are hardcoded.
A full-tree audit (2026-06) scored 9/10 with hygiene-level findings only.
The above describes the App Store build. The direct build (target Hidden Bar
Direct, unsandboxed) additionally links Sparkle
2 for self-update: it fetches one appcast from the GitHub release assets over
HTTPS and installs only archives whose EdDSA signature matches SUPublicEDKey.
No system profile is sent (Sparkle's SUEnableSystemProfiling stays off). The
App Store binary contains no Sparkle code, framework, or Info.plist keys; see
the RUNBOOK for how that split is built and checked.
- The notch: hidden icons sit "under" the notch area on notched Macs; the trick cannot reveal them there. The real fix is a spillover/second-bar design (tracked in issues #357/#341/#148; candidate implementations in PRs #350/#358).
- macOS 27: the menu bar re-architecture in macOS 27
(
NSMenuBarNavigationSceneExtension) breaks length-inflation hiding entirely (issue #360). The direct build hides natively there (NativeVisibilityEngine, which reads the sections over Accessibility); the App Store build cannot, because the sandbox blocks those reads, and keepsLegacyLengthEngine, which does not hide on 27. The behavior of macOS 27's own overflow « (when items land in it, never behind the notch) is re-measured byscripts/overflow-probe. - Other apps' open menus: interaction-awareness is pointer-position-based; a pointer deep inside another app's open dropdown is below the menubar band, so the collapse can still fire there.