Repository navigation
Conversation
macOS 26 places status-item windows asynchronously: for roughly the first second after launch every button window still reports origin (0,0). The launch collapse ran on a flat 1s delay and decided whether the arrow sat to the right of the separator by comparing those origins, so the check reduced to 0 >= 0 and was trivially true. The bar collapsed before the order could be verified. Combined with a stale "NSStatusItem Preferred Position" that placed the arrow to the left of the separator, that collapse pushed the app's own control off-screen. The bar could no longer be reopened by clicking, because the arrow had been hidden inside the zone it just collapsed. - Treat unplaced geometry as unknown, never as a valid order. - Wait for real geometry before the launch collapse instead of a fixed delay. - Validate the saved item order before the status items are created and repair it around the separator. The separator keeps its slot, so the hidden zone stays where the user put it and only the misplaced items move. - Add a bounded rescue that expands and rebuilds the items if a collapse ever leaves the arrow off every screen. Refs consolelabs#336
7 of 9 tasks
tieubao
added a commit
that referenced
this pull request
Nov 15, 2026
macOS 26 reports every status item at (0, 0) for about a second after launch. MenuBarOrder.isItem compared those origins, so 0 >= 0 passed and the 1 s launch collapse ran before the order was known. With a saved order that put the arrow left of the separator, the inflated separator then hid the arrow and left no control (#336). - MenuBarOrder treats an item at (0, 0) or with no window as unplaced, and an order check with an unplaced item answers false. - Engines report isArrangementKnown (legacy: arrow and separator placed; native: always). The launch collapse waits for it, every 0.25 s for up to 4 s more, then lets the order checks decide. The separator restore moved into the same wait, so it does not get refused on unplaced geometry either. Diagnosis and the geometry-ready guard come from #381 (antib0t), which patched the controller before the engine split. Its saved-position repair and arrow rescue are not ported: with an honest check, a stale order only refuses the collapse and the arrow stays visible. Refs #336, #381
tieubao
added a commit
that referenced
this pull request
Nov 15, 2026
* fix: let SystemUIServer Menu Extras be sectioned so Time Machine can stay visible systemItemOwners excluded com.apple.systemuiserver from the layout, but its legacy Menu Extras (Time Machine...) carry no system item identifier, so the native visibility restriction could never allow them and macOS hid them unconditionally. Only Control Center and MenuBarAgent items are protected by system item IDs; SystemUIServer extras are now sectioned by position like any other app. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014XPicPd2cqFey3v7ew7pzG * test: cover multi-item, always-hidden and RTL sectioning for SystemUIServer extras Adds resolver tests for the most-visible-wins rule across same-bundle items, the always-hidden section, and RTL geometry, and softens the engine comment to read as observation rather than fact. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix: detect Option from live modifier flags on macOS 27 On macOS 27 the mouse-up event that NSStatusBarButton hands to its action carries empty modifier flags even while Option is physically held, so Option-click on the arrow never reached the separators/always-hidden toggle and fell through to a plain toggle or the context menu. Treat Option as pressed when either the event or the live keyboard state (NSEvent.modifierFlags) has it. Older macOS versions, where the event flags are set, behave as before. Closes #434 * docs: describe Option-click for the always-hidden section in the tutorial The in-app tutorial in every locale still said to right-click the arrow to hide and show the always-hidden section. Since v1.11 right-click opens the context menu (#356) and the toggle is on Option-click, as the manual already says, so the tutorial led users to report a regression. Update the two steps in all ten locales. The French text also pointed at a «view» icon instead of «<», and the Arabic one had a typo in the same line; both fixed while rewriting. Translations other than English and Chinese have not been reviewed by native speakers. Refs #434 * fix: hide the always-hidden separator with its section on macOS 27 With "hide separators" on, the native engine hid the always-hidden icons but left their separator in the bar while expanded, and a zero-width separator while collapsed. Take it out of the bar (isVisible = false) whenever its section is hidden, and bring it back only after the icons are hidden or the restriction is dropped, so it never disappears on its own. If hiding fails it stays visible. This replaces the earlier zero-width approach, whose comment assumed isVisible = false makes macOS forget where the user placed the item. Checked on macOS 27.0 (26A428) with a Debug-Direct build: macOS puts the separator back at the user's position, and the sections are read correctly afterwards. Because the separator may be out of the bar at launch, applying a saved "hide separators" state now waits for the same 1 s delay as the initial collapse, so the items are back in place first. This part is in StatusBarController and applies to the legacy length engine too: on older macOS the always-hidden section is hidden about a second after launch rather than immediately. Refs #434 * fix: keep the always-hidden separator in sync when re-enabled Enabling the always-hidden section creates a fresh separator item, which AppKit puts in the bar visible. On macOS 27 two things could then go wrong: - Enabled while collapsed, the engine only set its length to zero, so the separator stayed in the bar as a clickable gap. The native engine now takes it out of the bar, as it does for the rest of the collapsed section, and the controller hands the item to the engine only after setting it up, so the engine has the last word. - Enabled while "hide separators" was saved as on, the new separator showed but the preference still said hidden, so the next Option-click only flipped the preference and appeared to do nothing. Turning the section on from Preferences now resets it, so the separator can be dragged into place and hidden with Option-click as the tutorial says. Launch keeps the saved state. The legacy engine only sets lengths and is unaffected by the reordering. Checked on macOS 27.0 (26A428) with a Debug-Direct build: with "hide separators" on, turning the section off and on in Preferences shows the separator, and a single Option-click hides it. Refs #434 * Avoid creating preferences UI during auto-collapse checks * perf: scan menu-bar apps concurrently on macOS 27 native hiding The Accessibility inventory queried every running app serially, so each collapse waited for the sum of all per-app round-trips (about 2.5s on a session with ~90 apps, several seconds more when an app is slow). The queries are independent IPC calls, so run them with concurrentPerform and keep results in running-app order. Also log how long the scan takes. * fix: hide icon from dock when "use full menu bar" is unchecked * fix: stop "Custom View" placeholder showing under the prefs tab switcher * fix: avoid toolbar clipping into preference pane helper graphic * fix: don't bother fit-to-tab for a non-resizable window * fix: use absolute center for the preference tab switcher in the window * chore: prune orphan "Keep icon in dock" translations * fix(macos27): restore clock interaction while collapsed Adapted from dwarvesf/hidden PR #453, commit 42be6f8. * fix(macos27): replay clock clicks and recover failed visibility restore * fix(macos27): fail open for menu-bar items the allow-list cannot keep On macOS 27 the native engine shows only what the assessment-mode allow-list names: system item ids, which on 27.2 cover only battery, bluetooth, clock, displays, keyboard, volume, wifi, Control Center and screen mirroring, plus bundle ids of visible apps. Everything else was hidden wherever the user put it: - Focus, Now Playing, Siri, Stage Manager and the other system extras are MenuBarAgent items, which the resolver dropped as system items although no system item id covers them. - Items whose owner has no bundle id, or is not an .app, never reached the allow-list. - Apps that missed the 0.1 s Accessibility timeout were left out. Now system extras are sectioned by position from their Accessibility identifier (com.apple.menuextra.*, one level below the hosting view on 27.2) and kept through Control Center's bundle. After collapsing, the engine checks that such extras right of the arrow are still listed; macOS drops hidden extras from Accessibility. If one is gone, the restriction is dropped and the extra is remembered, so later collapses keep the bar whole while it sits right of the arrow. An item with no bundle id right of the arrow also keeps the bar whole. Bare executables are now scanned, apps that do not answer get a 1 s retry, and an app that still does not answer counts as visible. Refs #446, #444, #442, #440, #436, #432, #424, #414, #413, #412, #411, * fix(macos27): re-read apps that time out in the concurrent AX scan With every app read at once, a slow app (Little Snitch, claude-swap on the test Mini) can miss the 0.1 s messaging timeout. It then drops out of the allow list and hides on collapse even when it sits in the visible section: 2 of 12 launches on macOS 27.2. Apps whose read returns kAXErrorCannotComplete get one more read with a 0.5 s timeout after the concurrent pass. The re-read is bounded to one and costs nothing when every app answers. * docs(readme): list the official download channels GitHub Releases, the Homebrew cask and the Mac App Store are the only channels Dwarves runs; other sites such as hiddenbar.app are not ours (#462). * test: add Debug-only hooks to drive the bar without pointer input Verification on a Mac in daily use cannot send clicks or keys. Debug builds now listen for a distributed notification (com.dwarvesv.minimalbar.debug.command) with commands collapse, expand, toggle, toggle-always-hidden (the Option-click action), always-hidden-section and full-menu-bar (the Preferences checkbox setters), boundary / always-hidden-boundary (section positions without a Cmd-drag), click-clock, and dump-state (JSON with the engine state, per-bundle sections, the allow list and the activation policy). click-clock posts the mouse pair to MenuBarAgent's process only and then runs the engine's clock-click handler, the same callback the global mouse monitor calls; under the hook the clock replay is posted to that process too, never to the HID stream. Everything sits under #if DEBUG; a Release-Direct binary contains none of it. * test: report fail-open state in the Debug dump-state hook dump-state now also writes the visible system extras the engine has to check (unprovenVisibleSystemItems), visible items with no bundle id (unnameableVisibleItems), the extras macOS was seen hiding (unkeepableSystemItems) and the last reason hiding was unavailable, so the no-input harness can check Focus and Now Playing without a click. Debug builds only. * feat(appstore): tell macOS 27 users the sandboxed build cannot hide icons The App Store build cannot read Accessibility on macOS 27, so it cannot hide menu-bar icons there. On macOS 27+ it now shows a one-time alert (once per app version, "Don't show again" to silence it for good) that points to dwarves.foundation/opensource, plus a status menu entry to reopen it. The button only opens the web page; nothing is fetched or installed (App Review 2.4.5(iv)). Compiled only without HIDDENBAR_NATIVE_VISIBILITY, so the direct build carries none of the code. English strings added to en.lproj. A DEBUG-only launch argument (-forceMacOS27Notice YES) forces the macOS 27 path. * fix(macos27): keep hiding when macOS also hides an item right of the arrow The fail-open fallback stopped hiding altogether while an item the allow list cannot keep sat right of the arrow. On a Mac with Focus or the user menu extra there, macOS hides those on every collapse, so Hidden Bar never collapsed: worse than v1.11.1. By default the engine now hides as v1.11.1 did, for both cases: system extras no system item id covers, and owners with no bundle id (#465). The visibility check still runs once per extra and records the extras macOS hid. Preferences on macOS 27 lists them by name ("macOS 27 also hides: Focus, User") and offers an opt-in, off by default, that keeps every icon shown while one of them is right of the arrow (the previous behavior). The slow-app re-read and "unreadable apps with a bundle id stay visible" are unchanged: those apps are allow-listable and never block hiding. * fix(login): retry legacy login item removal when it fails (#456) removeLegacyLauncherLoginItem ignored the SMLoginItemSetEnabled result and set the smAppServiceMigrated flag unconditionally, so a failed cleanup was never retried and the stale LauncherApplication entry stayed in Login Items. Move the logic to LegacyLoginItem.remove: set the flag only when the system reports success, log a one-line hint pointing at System Settings > General > Login Items on failure, and retry on the next launch. * fix(multi-display): measure sections per display and survive narrow menu bars On macOS 27 with two displays, AppKit reports the arrow's window on the display whose menu bar is active, and Accessibility lists the other apps' items on that display too, but the two reads can come from different displays. Sections were compared by raw x, so an arrow reported on a display to the right put every item on the hidden side and the whole bar vanished on collapse (#390); the reverse hid nothing. A narrow display's menu bar also overflows, and Accessibility then lists only the items that fit, so apps the user kept visible were left off the allow list. - MenuBarDisplay maps each screen to AppKit and Accessibility frames, measured from the primary display's origin (a display arranged above it has a negative Accessibility y; PR #422 measured from the topmost one). - The resolver moves the separators to each item's display by their distance from the arrow edge; an item on no display stays visible, and an arrow on no display keeps the bar whole. - The overflow chevron marks a read incomplete. Missing apps keep their section from the last complete read; with none, the bar stays whole. The chevron is no longer reported as a system extra macOS hides. - A display change keeps the bar collapsed (PR #422 expanded it on every display change, app launch and wake). - Legacy engine (from PR #452): a display change resizes the separator and the always-hidden spacer independently, with injectable screen widths. Refs #390, #422, #452, #451 * fix(macos27): keep a clock click from stranding a collapse in calibrating With "show all icons while macOS would also hide one" on, a collapse reports back only after a 0.5 s check that the system extras stayed shown. A click on the clock during that window lifted and re-applied the restriction, which bumped the generation, so the check returned early and never called the completion. The engine then sat in .calibrating for good: collapse requests were ignored and the controller would not expand, so the bar could neither collapse nor expand until Hidden Bar was quit. The clock lift now also waits while a collapse is calibrating, as it already did for activations and section reads in flight. A click in that short window does not open Notification Center; the next one does. Test: UnkeepableItemsOptInTests.testClockClickDuringTheCheckLeavesTheCollapseToFinish fails before (results [], state calibrating) and passes after. * fix(macos27): show apps that start while hiding in their last known section The native engine allow-lists the apps its last read found right of the arrow. Any app that starts while that restriction is held is not on the list, so macOS hid it wherever its icon landed: a login item that starts after Hidden Bar (#446: "at launch it hides about half of the icons, fine after expand and collapse"), an app relaunched after being quit at the last read, a brand-new icon. Users saw icons they had placed visible vanish until the next collapse. Now: - Every read is remembered per bundle (UserDefaults, nativeVisibilityLastSections), so the memory survives a Hidden Bar restart or a login. - On NSWorkspace launch, an app the current read does not list gets its remembered section, or visible if it was never read. If that section is shown, the held restriction is swapped for one that also allows it, the new one activated before the old is dropped (no flash). Not while an activation is in flight; the collapse or expand that lands applies it. - An app that started before the read but whose icon was not listed yet gets the same treatment in that read. - A read always wins: the next collapse places every listed app by position, so a brand-new icon macOS puts on the far left is hidden from then on. - Hidden Bar itself and macOS's item owners are ignored. Trade-off: a position read still wins over the memory, so an app whose icon macOS forgets and re-inserts on the far left is hidden from the next collapse on, as before. Telling that apart from a user's ⌘-drag needs the managed order of #366. A brand-new app shows until the next collapse instead of starting hidden; that is the fail-open direction the engine already takes for unreadable apps and items on no display. The factory wires the persistent memory and the workspace notifications; the initializer defaults keep tests off both. MANUAL documents the behaviour, the per-app caveat and the no-bundle-id limit. Tests: AppsLaunchedWhileHidingTests (12). Negative control: six one-at-a-time mutations (launch handler no-op, memory ignored, memory not written, no merge into the read, no swap after a collapse lands, default hidden) each fail 1 to 7 of them. * chore(test): add scripts/test.sh for fast, parallel scheme runs Builds each scheme once with build-for-testing into a persistent derived-data dir, then runs test-without-building. The Hidden Bar (Debug-Direct) and Hidden Bar App Store (Debug) schemes run at the same time, each with its own derived-data subdir and result bundle, with -parallel-testing-enabled YES. --changed [BASE] maps files changed against BASE (default origin/develop) to test classes and passes -only-testing. A source file with no mapped test, or a project, plist or script change, falls back to the full suite. Prints a timing table and exits non-zero on a build failure, a test failure, or no tests run. * fix(macos27): show the whole bar while a mic or camera is in use macOS 27 native hiding only exists as assessment (exam) mode, which also hides the menu-bar capsule naming the app that records (#432). NativeVisibilityEngine.activate requested a restriction whatever the capture state, so the indicator stayed hidden for as long as the bar was collapsed. Hold no restriction while any process records from a microphone or uses a camera, and re-apply the user's state from a fresh read when it stops. Detection (CaptureActivityMonitor) reads public CoreAudio per-process input state and CoreMediaIO device state and never prompts. Ported from #438 onto the release branch, which now also carries the clock passthrough (#467) and launched-app allowing: - dropping the restriction for capture also unwatches the clock, so an unrestricted clock opens Notification Center by itself - a failed restore after capture fails open to expanded, as the clock restore does - the engine defaults to a never-active monitor so tests do not depend on whether the Mac is recording; MenuBarEngineFactory injects the real one Seven engine tests, three of which fail without the capture guard. Fixes #432 Related to #437 Co-authored-by: Kevin Hallmark <khallmark@users.noreply.github.com> * feat(l10n): add Turkish translation and register it in the project PR #320 added tr.lproj strings files but never registered the language in the project, so they never compiled. Adds tr to knownRegions plus file references and variant-group children for Main.strings and Localizable.strings. Salvaged against the current tree: - dropped the two obsolete Custom View toolbar keys (NIO-JJ-pjq) - tutorial steps now say Option-click, matching the English text - Main.strings: 46 of 48 keys translated, 2 fall back to English - Localizable.strings: 7 of 22 keys translated, 15 fall back to English - LauncherApplication/tr.lproj/Main.strings from the PR is not carried over; the launcher target has no localizations in this tree The edited tutorial lines are not reviewed by a native speaker. Co-authored-by: Mete Kılıç <50811249+Metekilic@users.noreply.github.com> * feat(l10n): add Ukrainian translation and register it in the project PR #226 added uk.lproj strings files and its own project edits, but the project edits never merged and the strings never compiled. Adds uk to knownRegions plus file references and variant-group children for Main.strings and Localizable.strings. Salvaged against the current tree: - dropped the two obsolete Custom View toolbar keys (NIO-JJ-pjq) - tutorial steps now say Option-click, matching the English text - Main.strings: 47 of 48 keys translated, 1 falls back to English - Localizable.strings: 7 of 22 keys translated, 15 fall back to English - LauncherApplication/uk.lproj/Main.strings from the PR is not carried over; the launcher target has no localizations in this tree The edited tutorial lines are not reviewed by a native speaker. Co-authored-by: Voltangle <61655029+voltangle@users.noreply.github.com> * feat(l10n): add Italian translation and register it in the project PR #196 added it.lproj strings files and its own project edits, but the project edits never merged and the strings never compiled. Adds it to knownRegions plus file references and variant-group children for Main.strings and Localizable.strings. Salvaged against the current tree: - dropped the two obsolete Custom View toolbar keys (NIO-JJ-pjq) - tutorial steps now say Option-click, matching the English text - Main.strings: 47 of 48 keys translated, 1 falls back to English - Localizable.strings: 7 of 22 keys translated, 15 fall back to English - LauncherApplication/it.lproj/Main.strings from the PR is not carried over; the launcher target has no localizations in this tree The edited tutorial lines are not reviewed by a native speaker. Co-authored-by: Gian Marco Cinalli <9024983+gmcinalli@users.noreply.github.com> * feat: add a stealth mode preference that fades the collapsed arrow Issue #173 asks to hide the triangle button. PR #194 did it with a new asset plus storyboard frames from an older Xcode, and PR #266 baked a 32 percent opacity into the arrow PNG for everyone. Neither ports cleanly, so this re-does the idea against the current code. A Preferences checkbox, off by default, draws the collapsed arrow at 5 percent opacity. The expanded arrow stays fully visible, so the app can still be found and clicked. The fade is drawn from the existing template image, so no new asset is needed and the menu bar still tints it for light and dark mode. Toggling the checkbox redraws an already collapsed arrow at once. The opacity rule and the image fade are plain functions on Assets, covered by six unit tests in HiddenTests. A mutation of the rule to the wrong boolean fails one of them. The checkbox label is English only; the other locales fall back to it, like the Notch Overflow checkbox. Not verified on screen: no GUI launch was done for this change. Refs #173 * feat(updates): add Sparkle auto-update to the direct build only Issue #220 (dup #197): GitHub and Homebrew users had no update path. - New target "Hidden Bar Direct" (scheme "Hidden Bar", Debug-Direct and Release-Direct) links and embeds Sparkle 2.10.1 (exact pin). The App Store target and scheme are unchanged and have no Sparkle package, flag, or Info.plist keys. SwiftPM cannot link a package per configuration, hence the second target. - UpdateController (compiled only in the Direct target, HIDDENBAR_SPARKLE): SPUStandardUpdaterController, a "Check for Updates..." context-menu item, and an "Automatically check for updates" Preferences checkbox. - hidden/Info-Direct.plist adds SUFeedURL (the latest release's appcast.xml asset) and SUPublicEDKey. The private key is in 1Password, not the repo. - Unused target/config combinations are named "Hidden Bar (unused)" so the test bundles resolve exactly one host app per configuration. - RUNBOOK: Sparkle appcast release step and the Direct vs App Store split. Verified: scripts/test.sh green (123 direct, 108 App Store, same as before); otool shows Sparkle linked in Release-Direct and absent from Release; no new build warnings. Integration on release/v1.11.2-batch4 (after the mic/camera fix and the tr/uk/it + stealth commits): project.pbxproj conflicted because this commit re-sorts its sections. Resolved by taking this commit's project.pbxproj and re-adding, with their original object IDs, the registrations of the earlier commits: CaptureActivityMonitor.swift (Hidden Bar, HiddenBarTests, and now Hidden Bar Direct), StealthExpandIconTests.swift (HiddenTests), and tr/uk/it in knownRegions and both variant groups (shared by both app targets). * fix(project): make HiddenTests depend on the Hidden Bar Direct target HiddenTests imports Hidden_Bar and, under Debug-Direct, is hosted by the app that Hidden Bar Direct builds. Its only target dependency was still the App Store target, which in the Direct configurations builds "Hidden Bar (unused)" (module Hidden_Bar__unused_). So the Hidden_Bar module was ready in time only when the parallel scheme build happened to finish Hidden Bar Direct first. One of three fresh-derived-data runs of scripts/test.sh failed this way, under load: "Unable to resolve module dependency: 'Hidden_Bar' (in target 'HiddenTests')". Add Hidden Bar Direct as a second explicit dependency. Nothing runs HiddenTests in Debug/Release (the App Store scheme tests HiddenBarTests only), so the extra dependency costs nothing there. * chore(debug): time each step of the clock replay Debug builds record when the restriction is lifted, when MenuBarAgent answers, when the press is posted, when Notification Center shows, and when the restriction is back, in dump-state (clockTimeline) and the log. The click-clock hook takes "ax" to replay with AXPress, which opens the panel without pointer input. Release builds are unchanged. * fix(macos27): shorten the icon flash when the clock opens Notification Center A click on the clock while collapsed lifts the restriction, replays the click, and used to hold the lift until the panel window showed (a 20 ms poll of a 6 ms window-list read, up to 0.5 s). Measured on 27.2, the panel opens and stays open when the restriction is back a moment after MenuBarAgent took the press, so the restriction now comes back 40 ms after the replayed click is posted. - A press that opened nothing (no panel within 0.3 s) is pressed once more, this time holding the lift until the panel shows. A panel that opened late is never pressed closed. - A watchdog brings the restriction back 0.6 s after any lift, even if the press never reports back. - The panel check reads the window list without .excludeDesktopElements (about 1 ms instead of 6) and polls every 5 ms. Debug hook runs, 10 each, lift to restriction back: median 216 -> 132 ms; hidden extras listed in Accessibility: median 144 -> 77 ms, p90 179 -> 95. The panel opened in every run. ClockReplay tests drive the timing with a manual clock; six new tests fail on the old fixed-delay logic. * feat(macos27): expand the bar while the clock's Notification Center is open A click on the clock while the bar was collapsed lifted the restriction for a moment, replayed the click and put the restriction back, so hidden icons flashed. Now the click expands the bar through the controller's own expand (the same as a click on the arrow: state, arrow image, auto-collapse, activation policy), replays the click on the unrestricted clock, and collapses the bar again once the panel closes. - NotificationCenterSession (MenuBarClock.swift) is the state machine. It checks the panel every 0.1 s (one window-list read) only while the panel is open, stops at the collapse, and gives up after 10 minutes, leaving the bar as it is. - Only a bar the click expanded is collapsed. A bar that was already expanded, or one the user expands or collapses while the panel is open, stays as the user left it. A click that closes the panel counts as the close. - Auto-collapse waits while the session is active. - A press that opened nothing is retried once (0.3 s timeout kept); if nothing opens, the bar goes back to collapsed. - The lift around the press, and its watchdog, remain only for the one case that still holds a restriction while expanded: the always-hidden section hidden. The press then waits for the expand's activation to land. Unit tests drive the session and the engine with a manual clock and a fake panel probe; mutating the engine back to the lift-and-reapply logic fails five of them. * fix(autohide): wait for a menu-bar popup before auto-collapsing When the auto-hide timer fires, one CGWindowList read checks for a popup hanging from the menu bar: a pop-up-menu or status level window, or a window of an app with a menu-bar item, that touches the menu-bar band and reaches below it, or the Notification Center panel. If one is open the timer re-arms, the same way the pointer-in-band deferral does, for up to 10 minutes; then the bar collapses anyway. Hidden Bar's own windows are ignored (Preferences already defers). This covers a menu-bar app's popover or menu (#319) and Notification Center opened on a bar the user expanded, which the clock session does not track. The timer lives in StatusBarController, so both engines get it. On macOS 27 the menu bar draws every app's items itself and lists no per-item windows, so the native engine now exposes the bundles its last read found (menuBarItemOwners); before 27 the item windows in the band name their owners from the same read. * feat: pick the expand/collapse arrow style in Preferences Issue #310 asks for a short predefined list of arrow looks instead of one fixed icon. Preferences gets one popup, "Arrow style", with four entries: the current arrow (default), a chevron, a dot and a thin line. Each entry shows a preview of its collapsed and expanded glyph, and picking one redraws the status item at once. The choice is one string preference (arrowStyle). Unknown or missing values read as the current arrow, so existing users see no change. The chevron and dot are SF Symbols and the line is drawn, all as template images, so the menu bar tints them for light and dark mode. The arrow style keeps the shipped PNG assets and the right-to-left mirroring. No new asset files, so the Hidden Bar and Hidden Bar Direct targets both pick it up through Assets.swift, Preferences.swift and the Preferences view controller. It composes with stealth mode from #173: the collapsed image of any style is drawn at the stealth opacity, the expanded image stays opaque. The popup strings are English and added to every Localizable.strings, so no locale shows a raw key. The popup is built in code, so the storyboard and the generated Main.strings files are untouched. Fifteen tests in HiddenTests cover the default, the stored-value mapping, the setter and its notification, distinct template images per style and state, the default style matching the legacy arrow in both directions, stealth with every style, and the string keys in every locale. One test renders each style to a PNG (light and dark bar, normal and stealth) when ARROW_STYLE_PNG_DIR is set. Not verified on screen: no GUI launch was done for this change. Refs #310 * fix(legacy): keep the launch collapse from hiding the arrow on macOS 26 macOS 26 reports every status item at (0, 0) for about a second after launch. MenuBarOrder.isItem compared those origins, so 0 >= 0 passed and the 1 s launch collapse ran before the order was known. With a saved order that put the arrow left of the separator, the inflated separator then hid the arrow and left no control (#336). - MenuBarOrder treats an item at (0, 0) or with no window as unplaced, and an order check with an unplaced item answers false. - Engines report isArrangementKnown (legacy: arrow and separator placed; native: always). The launch collapse waits for it, every 0.25 s for up to 4 s more, then lets the order checks decide. The separator restore moved into the same wait, so it does not get refused on unplaced geometry either. Diagnosis and the geometry-ready guard come from #381 (antib0t), which patched the controller before the engine split. Its saved-position repair and arrow rescue are not ported: with an honest check, a stale order only refuses the collapse and the arrow stays visible. Refs #336, #381 * fix(macos27): explain the missing Accessibility permission On macOS 27 the direct build hides through Accessibility. Without the grant a click on the arrow hid nothing, and nothing said why: the system prompt shows once per launch and is easy to dismiss. - Preferences shows "Hidden Bar needs Accessibility access to hide icons." with an "Open Settings…" button at the top of the settings while the grant is missing. The button raises the system prompt and opens Privacy & Security > Accessibility. - A click on the expanded arrow that cannot hide opens Preferences. The launch collapse and the auto-hide timer do not. - macOS posts com.apple.accessibility.api when any app's grant changes. 0.5 s later Hidden Bar re-reads its own trust: the banner follows it, and a grant that went from missing to present retries the collapse once, without a relaunch. Other apps' changes leave an expanded bar alone. - AccessibilityPermission takes the trust check and the notification center as inputs, so the tests use a fake. The legacy engine and the App Store build never need the grant and never watch for it. - Strings: English key in every locale, the German text from #433. Ported from #433. Not ported: the Preferences rewrite (the toolbar overlap is fixed by #460 and pinStatusBarBelowToolbar), the shortcut recorder changes, the string relabels, and the Constant.isUsingLTR change. Co-authored-by: Richard Demann <249132531+richarddemann@users.noreply.github.com> * feat(prefs): hover-to-expand checkbox and per-engine tutorial text Hover-to-expand was only reachable through `defaults write`. Preferences now has a checkbox bound to the setting. Changing it takes effect at once: the status bar installs or removes its mouse monitor when the preference changes, where before the monitor existed only if the default was true at launch. The always-hidden tutorial told users to drag the translucent bar left of the normal bar. On the native engine (direct build, macOS 27) there is no normal bar; the arrow is the boundary. That build now reads a second string, "Tutorial text (arrow boundary)", chosen through MenuBarEngineFactory.usesNativeEngine(). Both new keys are English in every Localizable.strings, so no locale shows a raw key. Eight tests in HiddenTests cover the default, the setter and its notification, the checkbox reflecting and writing the stored value, the string choice per engine, the engine choice per OS, and the keys in every locale. * docs(backlog): rewrite the backlog to match the v1.11.2 candidate Removes what is done: the v1.11 cut (v1.11.1 is the latest release), UAT and merge of #365, the AXPress, SMAppService, Cmd+W and single-instance fixes (#415, #416, #417, #419), the notch overflow PR (#420), the community PR reviews (#350, #358), the round-2 close sweep, the Tutorial text and hoverToExpand items, and the superseded adaptive-width experiment. Keeps and updates the open items: shipping #468 and the Sparkle appcast first release, the direct bundle id decision, the App Store build on macOS 27, #469, the three hardware checks (#351, #456, #361 and #386), the old branch decision, #242, and the #366 epic with its still-open dependents. Adds the list of things unverified on hardware for v1.11.2. * docs(manual): explain the missing date in the clock when collapsed On macOS 26 and earlier the collapsed bar takes the menu-bar space macOS measures, so macOS drops the date from the clock (issue #207). Adds a troubleshooting row with the Control Center clock setting that fixes it, and notes that macOS 27 with the direct build is not affected. * chore(release): bump to v1.11.2 (build 17) and finalize the changelog MARKETING_VERSION 1.11.2 and CURRENT_PROJECT_VERSION 17 in all eight app-target configurations (Hidden Bar Direct and the App Store target, four each). Sparkle compares CURRENT_PROJECT_VERSION, so it must rise above v1.11.1's 16. The changelog entry is grouped by macOS 27, added and fixed, links the issues, and credits the community pull requests in this release. * docs(runbook): record the Developer ID archive and the real zip name A plain Release-Direct archive fails with "conflicting provisioning settings" because the target signs automatically for development. The release now archives with manual Developer ID signing and exports with the developer-id method, which re-signs Sparkle's nested code. The zip name in the appcast steps now matches the asset the Homebrew cask URL expects (Hidden-Bar-v<version>-macos.zip), not Hidden.Bar-<version>.zip. --------- Co-authored-by: renovys <renovy.ai@gmail.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Shigo-45 <C867469688@gmail.com> Co-authored-by: Danishjeet Singh <danishjeetsingh@gmail.com> Co-authored-by: Bernhard Keprt <4153888+goosefraba@users.noreply.github.com> Co-authored-by: Kittywhiskers Van Gogh <hi@kw.vg> Co-authored-by: Bhavesh Nigam <bhavesh.nigam@yahoo.com> Co-authored-by: Taylor <taylorich868@gmail.com> Co-authored-by: Kevin Hallmark <khallmark@users.noreply.github.com> Co-authored-by: Mete Kılıç <50811249+Metekilic@users.noreply.github.com> Co-authored-by: Voltangle <61655029+voltangle@users.noreply.github.com> Co-authored-by: Gian Marco Cinalli <9024983+gmcinalli@users.noreply.github.com> Co-authored-by: Richard Demann <249132531+richarddemann@users.noreply.github.com>
Contributor
|
Landed in v1.11.2 via #468 (squash merge, you are credited as co-author). Thank you! |
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.
fix: keep the expand/collapse arrow out of the hidden zone on macOS 26
Refs #336
Issue description
On macOS 26 the app launches, the icons collapse, and the expand/collapse arrow is nowhere in the menu bar. There is no control left to click, so the bar cannot be expanded again. From the outside this reads as "Hidden Bar stopped working", or as the app hanging on launch: the process is alive and the collapse worked, but the app has hidden its own only UI.
Quitting and relaunching does not help. The state that causes it lives in the app's defaults and survives an uninstall, so reinstalling does not help either.
Reproduced on macOS 26.5.2 (25F84), Apple silicon, single display. Present in v1.10 and in current
develop.Root cause
The launch collapse runs before the status items are placed
macOS 26 positions status-item windows asynchronously. For roughly the first second after launch,
NSStatusBarButton.window?.frame.originis still(0, 0)for every item.StatusBarControllercollapses on a flat 1s delay and gates that collapse onisBtnSeparateValidPosition, which compares those origins:With both origins at zero the comparison is
0 >= 0, so the guard passes on geometry that does not exist yet. The app collapses without ever checking where its own arrow is.Measured on 26.5.2, same launch, one second apart:
A stale saved order puts the arrow inside the hidden zone
macOS persists each item's slot as
NSStatusItem Preferred Position <autosaveName>in the app's own defaults. A larger value places the item further left (verified on 26.5, see below). The app only works when the group reads, left to right: always-hidden, separator, arrow. The arrow has to stay to the right of the separator, because collapsing inflates the separator and pushes everything to its left off-screen.A real user's defaults, carried over from an earlier install:
1000 > 717, so the arrow sat to the left of the separator, inside the zone the separator hides. The collapse then swallowed the arrow along with the user's icons:
The order check exists precisely to prevent this. It never got the chance to run on real numbers, because of the race above.
One correction to #360 while I was in here: on 26.5.2 the hide mechanism itself is fine. The separator's requested 4112pt is honored exactly, and icons do move off-screen. Counting menu-bar windows via
CGWindowListCopyWindowInfoat layer 25: 22 visible without the app, 12 with it collapsed. Length inflation on 26 works.Direction of the preferred-position value
The repair depends on knowing which way the value points, so I measured it instead of assuming. Two status items, positions written before creation:
An item with no saved value is placed by creation order, outside every item that owns a slot. That is why a partially saved set is normal rather than corrupt, and why the repair treats a missing value as outermost.
Steps to reproduce
The app's own defaults are what trigger this, so the reproduction seeds them directly. It is the state a real user arrived at through ordinary Cmd-dragging.
Before this PR the icons collapse and the arrow is gone, with no way to expand the bar again from the menu bar. After this PR the arrow stays visible at the inner edge, the same icons collapse, and clicking the arrow expands them.
To restore your own arrangement afterwards, delete both keys and let macOS re-place the items.
Fix details
Three changes in
StatusBarController.swift.Unplaced geometry now counts as unknown rather than valid. A new
isMenuBarGeometryReadyrequires both button windows to report a non-zero origin, and both order checks gate on it. A check that cannot see the layout answers no.The launch collapse waits for real geometry.
collapseWhenGeometryReady()replaces the flatasyncAfter(.now() + 1), retrying every 0.25s up to 20 attempts. If geometry never arrives the collapse still runs, and the order check, now honest, refuses it.The saved order is validated and repaired before the items exist. macOS reads the slot when the item is created, so
StatusItemPositions.repairIfNeeded()runs as the first statement ofinit(), ahead of the firststatusItem()call. Nothing is rewritten while the order is sound.The repair anchors on the separator and never moves it. An earlier version of this patch reassigned all the slots in sorted order. It put the arrow back on screen and quietly broke hiding, because the separator's slot is what defines the hidden zone, and moving it un-hides everything parked there. So the separator keeps its slot and only the misplaced items move, one slot's width to their own side:
Finally, a bounded rescue. If a collapse ever leaves the arrow off every screen anyway,
rescueArrowIfSwallowed()expands the bar, pulls the arrow inside the separator, and rebuilds the two status items so the arrow returns in the same session instead of after a restart. It is capped at two attempts, so a repair that does not take cannot turn into collapse/rescue ping-pong.Two smaller things came along with it. The
HideMechanism:diagnostic now logs the arrow's frame and whether it intersects any screen, which is the signal this class of bug turns on. The.prefsChangedobserver moved out ofgetContextMenu()intoinit(), since the rescue path rebuilds the UI and would otherwise register a duplicate.Testing
macOS 26.5.2 (25F84), Xcode 26.6, Release build, single 2056pt display. Menu-bar icon counts come from
CGWindowListCopyWindowInfoat layer 25. Arrow visibility comes from the button window's frame checked againstNSScreen.screens.arrow=1000, sep=717arrow=667, arrow on screen, 9 icons hiddenarrow=900, sep=400arrowOnScreen=true, 13 visible each timeThe repair is idempotent. It fires once on a broken state and stays quiet afterwards.
Three things I could not cover, for lack of hardware: multi-display, RTL, and macOS 27. The RTL paths mirror the existing LTR comparisons and are written but untested.
NSApplication.shared.userInterfaceLayoutDirectionis read directly instead ofConstant.isUsingLTRLanguage, because the latter is only assigned inapplicationDidFinishLaunching, which runs after the status items are built.