Skip to content

fix: activate the app when expanding with the full menu bar - #496

Closed
tieubao wants to merge 3 commits into
developfrom
fix/full-bar-activation
Closed

tieubao wants to merge 3 commits into
developfrom
fix/full-bar-activation

Conversation

@tieubao

@tieubao tieubao commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Bug

On a real Shift-click on macOS 27.2.1 (the real-click row in #491), "use the full menu bar on expanding" (the setting and the one-shot Shift-click from #486) switches Hidden Bar to .regular but the app never becomes active. The frontmost app's menus stay and the full bar is not freed. Likely related to #142.

Hypothesis (not proven)

expandMenubar called setActivationPolicy(.regular) and NSApp.activate(ignoringOtherApps: true) in the same runloop turn. On macOS 14+ activation is cooperative (a request, not a command), ignoringOtherApps is ignored and deprecated, and activating before the policy change has registered is a known failure.

Change

  • New FullBarActivation (in ExpandCollapseAction.swift): sets .regular, then requests activation on the next runloop turn. macOS 14+ uses NSApp.activate(), macOS 13 keeps activate(ignoringOtherApps:). The request is dropped if the bar collapsed or the full-bar wish ended in between.
  • expandMenubar uses it. Collapse path is unchanged and still reverts to .accessory + deactivate(); the skipped-activation guard covers a collapse that lands before the deferred turn.
  • Tests: 4 new FullBarActivationTests (call order, OS split, skip when collapsed). Both schemes via scripts/test.sh: 316 and 221 passed, 0 failed.

Not changed (other activate(ignoringOtherApps:) sites)

StatusBarController.syncActivationPolicyWithFullStatusBar (same policy-then-activate pattern, settings toggle), NSWindow.bringToFront, SystemOverflowNotice, MacOS27Notice, AppStoreMigration, UpdateController. Those run while the app already has a window or alert up; left alone to keep this fix scoped to the full-bar path.

Needs one real click on macOS 27 to verify; activation cannot be driven by a script.

Switching to .regular and activating in the same runloop turn leaves the app inactive on macOS 14+, where activation is a cooperative request. Activate on the next turn with NSApp.activate() (legacy call kept for macOS 13), skipped if the bar collapsed meanwhile.
Shift-click and a plain click with the full menu bar setting on: Orca stayed frontmost for 5.5 s, policy regular, Hidden Bar never active.
@tieubao

tieubao commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Closing unmerged. Two real clicks on macOS 27.2.1 with this build (Shift-click, and a plain click with the full-bar setting on) left Orca frontmost for 5.5 s; Hidden Bar turned regular but never became active. The original code already activated inside the click handler and failed the same way, so deferring one runloop turn is not the fix. Rows and crops are on this branch in docs/implementation-notes/shift-click-full-bar.md, section "Fix attempt (#496)".

@tieubao tieubao closed this Nov 15, 2026
@tieubao
tieubao deleted the fix/full-bar-activation branch November 25, 2026 13:49
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.

1 participant