Repository navigation
Conversation
On ultra-wide monitors (5120px+), macOS enforces a hard 10,000pt max for NSStatusItem.length and prevents status items from crossing the app-menu boundary. This causes hidden items to pile up visibly in the middle of the menu bar instead of being pushed off-screen. - Add MenuBarOverlayWindow (solid-black NSPanel) to cover hidden items that macOS cannot push off-screen on ultra-wide displays - Update collapse length calculation to use the screen where status items live (via button window) with fallback chain, capped at 10,000pt - Show overlay after collapsing with 0.5s delay for macOS to finish repositioning; hide overlay immediately on expand - Use NSStatusBar.system.thickness as fallback menu bar height for secondary screens where visibleFrame == frame - Leave 600px left margin so Apple menu and app menus stay visible - Change isCollapsed to threshold comparison instead of exact equality
laveez
reviewed
Mar 27, 2026
| // edge of the expand/collapse button's window. We leave a 600pt | ||
| // margin on the left so the Apple logo and application menus (e.g. | ||
| // Chrome File Edit View …) remain visible and clickable. | ||
| let appMenuMargin: CGFloat = 600 |
Contributor
There was a problem hiding this comment.
I wonder if hardcoded 600px is enough for all cases. Is there a possibility to get a real frame width or using some other dynamic approach?
| 92C97B8C220058740007559C /* NSView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSView+Extension.swift"; sourceTree = "<group>"; }; | ||
| 92C97B8E220147FE0007559C /* Constant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = "<group>"; }; | ||
| 92C97B9022018C1F0007559C /* StatusBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusBarController.swift; sourceTree = "<group>"; }; | ||
| AA1234560001000000000002 /* MenuBarOverlayWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuBarOverlayWindow.swift; sourceTree = "<group>"; }; |
Contributor
There was a problem hiding this comment.
Is this AA1234560001000000000002 an actual generated UUID?
| level = NSWindow.Level(rawValue: Int(CGWindowLevelForKey(.statusWindow)) + 1) | ||
| collectionBehavior = [.canJoinAllSpaces, .stationary, .ignoresCycle] | ||
| isOpaque = true | ||
| backgroundColor = .black |
Contributor
There was a problem hiding this comment.
Is this color ever visible or just a fallback? Could we use something like NSVisualEffectView with .menuBar material?
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.
Summary
NSStatusItem.lengthand prevents status items from crossing the app-menu boundary, causing hidden items to pile up visibly in the middle of the menu barProblem
Hidden Bar works by expanding
btnSeparateto a large width to push hidden status items off the left edge of the screen. On standard monitors this works fine, but on ultra-wide monitors (e.g. 5120px wide):NSStatusItem.lengthat 10,000ptSolution
Added a
MenuBarOverlayWindow— a solid-blackNSPanelpositioned just above the status bar level — that covers any hidden items macOS couldn't push off-screen.Changes
New file:
MenuBarOverlayWindow.swiftNSPanelwith solid black backgroundstatusWindowto cover stuck itemsignoresMouseEvents = false)Modified:
StatusBarController.swiftbtnExpandCollapse.button?.window?.screen), with fallbacks toNSScreen.mainandNSScreen.screens.firstNSStatusBar.system.thicknessas fallback for menu bar height on secondary screens (wherevisibleFrame == frame)isCollapsedto use threshold comparison (> btnHiddenLength) instead of exact equality, so screen-change recalculations don't break state detectionModified:
project.pbxprojMenuBarOverlayWindow.swiftto build sourcesTesting
Tested on a 5120x1440 ultra-wide monitor as a secondary display alongside a MacBook screen. Hidden items are properly concealed when collapsed, and the Apple menu + app menus remain fully visible and functional.