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.

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 at 45% of the narrowest attached screen on
macOS 27+, which stays under that limit. Filling the trailing region is
enough to hide everything, because macOS 27 moves the displaced icons
into its own native overflow menu. The narrowest screen is used rather
than the widest (the rule for macOS 26 and earlier) because one length
is applied to the item on every display's bar and the limit is per
display. macOS 26 and earlier keep the previous behavior.

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

Measured on macOS 27.0 (26A5388g) with a 2056pt display by sweeping the
length and capturing the MenuBarAgent window: 600/900/1000pt hide
correctly, 1028pt (exactly half) and above hide nothing. The limit is per
item, so the always-hidden separator works alongside this.
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

1 participant