Skip to content

Fix menu bar items on macOS 26.5: XPC peer requirement, image capture, spacing relaunch - #982

Open
keithadler wants to merge 1 commit into
jordanbaird:macos-26from
keithadler:fix-macos-26-5-items
Open

Fix menu bar items on macOS 26.5: XPC peer requirement, image capture, spacing relaunch#982
keithadler wants to merge 1 commit into
jordanbaird:macos-26from
keithadler:fix-macos-26-5-items

Conversation

@keithadler

Copy link
Copy Markdown

Three independent problems leave the Menu Bar Layout pane, the Ice Bar and search without items or images on macOS 26.5 (fixes #913, #946, #951; overlaps #950/#953 on the XPC part).

1. Same-team XPC requirement fails on builds without a team identifier

MenuBarItemService activates its listener with .isFromSameTeam() and the app sets the same peer requirement on its session. Ad hoc and self-signed builds carry no team identifier, so the requirement can never be satisfied: every sourcePID lookup fails and the item cache never fills ("Loading menu bar items…" forever). This applies the requirement only when the running process actually has a team identifier (Shared/Utilities/CodeSigning.swift, checked via SecCodeCopySigningInformation). Signed builds behave exactly as before.

2. CGWindowListCreateImageFromArray returns nil on macOS 26.5

The 26 SDK marks the API unavailable and on 26.5 it returns nil for every window, including on-screen ones (verified with a standalone probe), so cacheFailed(for:) reports "Unable to display menu bar items" everywhere. ScreenCapture.captureWindows keeps the CGWindowList path first, since it is the only API that can capture offscreen items, and falls back to a ScreenCaptureKit display capture limited to the requested windows' bounds (SCContentFilter(display:including:) + sourceRect). Offscreen windows are skipped, so hidden items receive their images whenever their section is shown; the image cache's merge semantics keep them afterwards. The sync call sites are preserved by running the capture on a detached task with a bounded wait.

3. Spacing relaunch loop skips apps

MenuBarItemSpacingManager used break where it needed continue, so every app after Control Center or Ice in the PID set was silently skipped and never relaunched.

Verified

macOS 26.5.2, ad hoc build: layout shows all items with icons in both sections, drag to rearrange moves items in the menu bar, Ice Bar and search show item images, hotkeys and spacing work.

🤖 Generated with Claude Code

…, spacing relaunch

Three independent problems left the Menu Bar Layout pane, the Ice Bar and
search without items or images on macOS 26.5:

1. The app and MenuBarItemService require same-team XPC peers
   (`.isFromSameTeam()`), which can never be satisfied by ad hoc or
   self-signed builds because they carry no team identifier. Every
   sourcePID lookup failed and the item cache never filled. Apply the
   requirement only when the running process actually has a team
   identifier (Shared/Utilities/CodeSigning.swift). Signed builds keep
   the same behavior as before.

2. CGWindowListCreateImageFromArray returns nil for every window on
   macOS 26.5 (the 26 SDK marks it unavailable), so no item image could
   be captured and cacheFailed(for:) reported "Unable to display menu bar
   items". Keep the CGWindowList path first, since it is the only API that
   can capture offscreen items, and fall back to a ScreenCaptureKit
   display capture limited to the requested windows' bounds when it
   returns nil. Offscreen windows are skipped, so hidden items receive
   their images whenever their section is shown.

3. The item spacing relaunch loop used `break` where it needed `continue`,
   so every app after Control Center or Ice in the set was silently
   skipped and never relaunched.

Verified on macOS 26.5.2 with an ad hoc build: layout, drag to rearrange,
Ice Bar, search and spacing all work again.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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