Skip to content

fix: restore menu-bar hiding on macOS 27 (#360) - #382

Open
bhaveshnigam wants to merge 1 commit into
dwarvesf:developfrom
bhaveshnigam:bugfix/macos27-collapse-length
Open

fix: restore menu-bar hiding on macOS 27 (#360)#382
bhaveshnigam wants to merge 1 commit into
dwarvesf:developfrom
bhaveshnigam:bugfix/macos27-collapse-length

Conversation

@bhaveshnigam

Copy link
Copy Markdown

Fixes #360. Icon hiding stopped working entirely on macOS 27; this restores it using the existing mechanism, so there is no architectural change.

What's this PR do?

  • Sizes the collapsed separator to 45% of the narrowest attached screen on macOS 27+, instead of twice the widest screen.
  • Suppresses the separator's | glyph while collapsed on macOS 27+.
  • macOS 26 and earlier are untouched (#available gated), including the existing widest-screen rule and 10,000pt bound.

Root cause. macOS 27 discards a status item whose length reaches half the display width, where macOS 26 and earlier clamped it. Hidden Bar inflates the separator to widestScreen * 2, which is over that limit on every Mac, so on 27 the separator was dropped outright: it displaced no icons and its own glyph vanished. That accounts for both symptoms reported in #360 — hiding doing nothing, and the stray separator some users see mid-menu-bar.

Staying under the limit is sufficient to hide everything, because macOS 27 owns the overflow: once the separator fills the trailing region, the icons it displaces move into the system's native overflow menu («) rather than merely off-screen. The narrowest screen is used rather than the widest — the inverse of the pre-27 rule — because one length is applied to the item on every display's bar and the limit is per display, so a length sized for a wide screen would be over the limit on a narrow one and hide nothing anywhere.

Measurements on macOS 27.0 (26A5388g), 2056pt display, by sweeping the separator length and capturing the MenuBarAgent window at each step:

separator length result
600 / 900 / 1000pt all icons left of the separator hidden
1028pt (exactly width / 2) and above item dropped, nothing hidden

The limit is per item, so the always-hidden separator can be inflated at the same time (verified with both sections enabled).

What are the relevant Git tickets?

Screenshots (if appropriate)

// attach the four PNGs from ~/Desktop/hiddenbar-360-screenshots/

Any background context you want to provide? (if appropriate)

Per CONTRIBUTING:

  • No new dependencies, and no project, entitlement, or preference changes. Four files touched: StatusBarController.swift, CHANGELOG.md, docs/ARCHITECTURE.md, docs/BACKLOG.md.
  • Existing features tested on macOS 27: collapse and expand both directions, repeated toggling, auto-collapse timer, and the always-hidden section with both separators inflated. macOS 26 and earlier are #available-gated and take the original code path unchanged.
  • Not verified, flagging deliberately: multi-display (the narrowest-screen rule is reasoned from the per-display limit, not measured on two monitors) and notched Macs. Verification used a locally compiled build of these sources rather than an Xcode archive, so a maintainer build is worth doing before release.

Verification note for anyone reproducing this: the menu bar cannot be captured with a plain screencapture when a fullscreen space covers it. Locate the MenuBarAgent window via CGWindowListCopyWindowInfo([.optionAll]) and capture it by ID (screencapture -x -o -l <id>), which works even when that window reports onscreen=false. Comparing PNG byte sizes across states is a cheap hidden/visible signal.

@alexzvn

alexzvn commented Aug 11, 2026

Copy link
Copy Markdown

Multi display didn't work :(

screen-recording image

@bhaveshnigam
bhaveshnigam force-pushed the bugfix/macos27-collapse-length branch 2 times, most recently from 16b9d4e to 5e7f3cf Compare August 16, 2026 10:20
macOS 27 discards a status item whose length reaches half the display
width instead of clamping it, as macOS 26 and earlier did. The separator
was inflated to twice the widest screen width, so on 27 it was dropped
outright: it displaced no icons and its own glyph disappeared, which is
the reported loss of hiding and the stray separator seen mid-menu-bar.

Size the collapse length to just under half the width of the narrowest
attached display. Below that cliff macOS 27 moves the icons the separator
displaces into its own native overflow menu, so a partial-width separator
still clears the bar, and the narrowest display is the only one whose
cliff every bar's copy of the item clears.

A bar clears only if the separator spans the distance from the icons to
that overflow boundary. The distance grows with display width while the
cliff is half of it, so beyond roughly 2800pt no length can hide: a 3840pt
display needs ~2900pt and never accepts more than 1919pt. Displays of
different widths therefore cannot both be served by one item: hiding on
the narrowest shifts the wider ones' icons sideways. Default to leaving
them alone (stay above every cliff, so macOS drops the item and no bar
changes) and add hideWithMixedDisplays to opt into hiding instead. Hiding
is unaffected with one display, or displays of equal width.

Two alternatives were tried on hardware and rejected: keying the length on
the pointer's display made the bars flicker between arrangements as the
pointer moved, and spreading the length over several items does not work
because macOS overflows the bar from the left, so the extra items fall
into the overflow themselves and leave the real icons untouched.

Also suppress the separator glyph while collapsed on macOS 27, where the
item's span is on-screen rather than off it. macOS 26 and earlier keep the
previous behavior.

Measured on macOS 27.0 (26A5388g) by sweeping the length and photographing
each display's menu bar in full: a 2056pt display hides at 600-1000pt and
drops from 1028pt; a 3840pt display drops from 1920pt and hides at no
length. The cliff is per item, so the always-hidden separator works
alongside this.
@iosdevben

Copy link
Copy Markdown

Is there likely to be a release of this fix, even if it only fixes it for those of us who don't use extra wide displays?

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.

Osx 27 broken hidden bar

4 participants