fix: restore menu-bar hiding on macOS 27 (#360) - #382
Open
bhaveshnigam wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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?
|glyph while collapsed on macOS 27+.#availablegated), 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
MenuBarAgentwindow at each step: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:
StatusBarController.swift,CHANGELOG.md,docs/ARCHITECTURE.md,docs/BACKLOG.md.#available-gated and take the original code path unchanged.Verification note for anyone reproducing this: the menu bar cannot be captured with a plain
screencapturewhen a fullscreen space covers it. Locate theMenuBarAgentwindow viaCGWindowListCopyWindowInfo([.optionAll])and capture it by ID (screencapture -x -o -l <id>), which works even when that window reportsonscreen=false. Comparing PNG byte sizes across states is a cheap hidden/visible signal.