Repository navigation
fix(native): keep apps and ⌘-drags with the menu bar set to auto-hide - #607
Open
DragonNameLeo wants to merge 2 commits into
Open
DragonNameLeo wants to merge 2 commits into
DragonNameLeo wants to merge 2 commits into
Conversation
With System Settings › Menu Bar › "Automatically hide and show the menu bar" on, macOS 27.2.1 parks every app's status items while the bar is hidden, and they leave Accessibility, Hidden Bar's own arrow included. A read taken then (the auto-collapse timer, a launch, or a relaunch before the icons are back) listed no app. It was cached, every app fell out of the allow list, and with the always-hidden section held on expand no later read replaced it: a click on the arrow showed nothing until Hidden Bar was relaunched. Measured on a live bar: every read that listed no app happened while MenuBarAgent logged "menu bar hidden", and every read taken while the bar was revealed listed the apps. - The inventory also asks whether Hidden Bar's own status items are in Accessibility. When they are not and no app item was read, the read is from a hidden menu bar (MenuBarHiddenRead). An unanswered own read never counts as hidden. - The engine keeps the last read instead of such a read and learns nothing from it: no pinned-table or section-memory edit, no catalog record, and it does not become lastCompleteLayout. - A running app the read did not list, but whose section Hidden Bar knows (pinned table, or section memory with pinned sections off), keeps that section. Apps not running, and apps never seen, are not filled in. Verified on 27.2.1 with the menu bar set to auto-hide: a read with the bar hidden logs "own items listed false, menu bar hidden true" and keeps 8 hidden and 3 always-hidden apps from the table; a read with the bar revealed logs "own items listed true, menu bar hidden false". The arrow shows the hidden icons afterwards. Tests: ReadListsNoAppTests (6). The direct scheme passes 822, fails 34; the same 34 fail without this change (UI copy tests on a Japanese-language Mac). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With pinned sections on and an app in the always-hidden section, an expand
keeps a restriction that hides that section, so the next collapse uses the
cached read and never sees where the user dragged an icon. Only a bar with
nothing held (Option-click, or the camera or microphone lift) was read again,
and with the menu bar set to auto-hide even that read came when the
auto-collapse found the bar already gone, so it was discarded. A ⌘-drag
across the arrow therefore never changed an app's section.
- CommandDragWatcher (MenuBarClock.swift) watches left mouse-down with ⌘ in
a menu bar, global and local, and reports the next mouse-up after 0.5 s,
once macOS has moved the icon and reflowed the bar. The bar is on screen
then, auto-hide or not.
- NativeVisibilityEngine.menuBarRearranged, pinned sections only:
- nothing held and expanded: a full read, cached, so a collapse that finds
the menu bar hidden keeps it;
- a restriction held (collapsed, or expanded with the always-hidden
section hidden): only the apps it shows are read, against the arrow,
since hidden apps report stale frames. An app the palette lifted for now
is left out. The table is edited through PinnedSectionResolver as on a
collapse, so "Ignore drags" and relaunches are respected, and the hold
follows at once.
- Skipped while presenting, while an activation is in flight, and when the
read finds the menu bar hidden.
- The engine posts .pinnedSectionsChanged so Settings › Icons and the catalog
follow; the controller skips the engine's own post.
Verified on 27.2.1 with the menu bar set to auto-hide and the always-hidden
section held on expand: three ⌘-drags of WeChat across the arrow logged
"a ⌘-drag moved com.tencent.xinWeChat to hidden / visible / hidden", each
from a read with "menu bar hidden false", and the pinned table followed.
Tests: PinnedSectionsTests (4 new). The direct scheme passes 826, fails 34;
the same 34 UI copy tests fail on this Japanese-language Mac without it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What and why
With System Settings › Menu Bar › "Automatically hide and show the menu bar" on, macOS 27.2.1 parks every app's status items while the bar is hidden. They leave Accessibility, and Hidden Bar's own arrow goes with them. Two things broke because of this:
d4f6173). Hidden Bar sometimes read the bar while it was hidden: on the auto-collapse timer, at a launch, or at a relaunch before the icons were back. That read listed no app. It was cached, and every app fell out of the allow list. With the always-hidden section held on expand, no later read replaced it, so a click on the arrow showed nothing until Hidden Bar was relaunched.lastCompleteLayout.e0d6453). With pinned sections on and the always-hidden section held on expand, a collapse used the cached read, so it never saw the drag.CommandDragWatcherreports the end of a ⌘-drag in the menu bar, 0.5 s after mouse-up. By then macOS has moved the icon and the bar is on screen.NativeVisibilityEngine.menuBarRearrangedreads the bar then. When a restriction is held, it reads only the apps that restriction shows. The table is edited throughPinnedSectionResolver, so "Ignore drags" is respected.How it was tested
own items listed false, menu bar hidden true, and the 8 hidden and 3 always-hidden apps stayed in their sections. The arrow showed the hidden icons afterwards.a ⌘-drag moved … to hidden / visible / hidden, and the pinned table followed every drag.ReadListsNoAppTests(6) andPinnedSectionsTests(4).scripts/test.sh --scheme direct: 826 passed, 34 failed. The same 34 fail ondevelopwithout this change. They are UI text tests, and they fail because the test Mac is set to Japanese.UI proof
Tick exactly one:
🤖 Generated with Claude Code