Skip to content

Fix invisible Menu Bar Layout pane on macOS 26 (white background, white text) - #972

Open
Pranav-Karra-3301 wants to merge 1 commit into
jordanbaird:mainfrom
Pranav-Karra-3301:fix-layout-bar-average-color
Open

Pranav-Karra-3301 wants to merge 1 commit into
jordanbaird:mainfrom
Pranav-Karra-3301:fix-layout-bar-average-color

Conversation

@Pranav-Karra-3301

@Pranav-Karra-3301 Pranav-Karra-3301 commented Aug 18, 2026

Copy link
Copy Markdown

Problem

On macOS 26 (Tahoe), the Menu Bar Layout pane renders as solid white rounded rectangles with nothing visible inside. Reported in #716, #901, #761, #891, #916, #743.

Two bugs stack on top of each other:

  1. The Tahoe menu bar window is fully transparent, so the 1px strip that MenuBarManager.updateAverageColorInfo() captures contains no pixels at or above averageColor()'s alpha threshold. includedPixelCount ends up 0, the component sums divide by zero, and the function returns a CGColor with NaN components instead of nil. Color(cgColor:) renders that NaN color as solid white regardless of the wallpaper. The wallpaper fallback branch never runs, because it is only reached when the menu bar window is missing entirely, not when its capture is transparent.
  2. Menu bar item images also fail to cache on Tahoe, so the pane shows the "Unable to display menu bar items" placeholder instead of items. Its color is picked with averageColorInfo?.color.brightness ?? 0 > 0.67 ? .black : .white. NaN comparisons are always false, so the text is forced white. White text on the NaN white background is invisible, which is why the pane looks completely empty rather than showing the error.

Pixel analysis of an affected machine (macOS 26.5.2, Ice 0.11.12) shows the section rows are uniform rgb(255, 255, 255) across every sampled pixel, consistent with the placeholder text being drawn white on white.

Fix

  • CGImage.averageColor(): return nil when no pixels qualify instead of dividing by zero. This is the same guard as Handle fully transparent average colors #967 by @offyotto, credit to them for spotting it first; happy to rebase if that lands.
  • MenuBarManager.updateAverageColorInfo(): when both windows are present, capture the menu bar window composited over the wallpaper window, so the transparent Tahoe menu bar picks up the wallpaper color behind it. This ports the approach the macos-26 branch already ships in 0.11.13-dev.2 to main, while keeping main's existing right-quarter sampling region. Pre-Tahoe behavior is effectively unchanged, since an opaque menu bar wins the composite. The original single-window branches remain as fallbacks.
  • LayoutBar: when no average color is available, use .primary for the placeholder text instead of forcing white, so it stays legible on Color.defaultLayoutBar in both light and dark appearance (for example when screen recording permission is missing and the capture fails).

Scope

This fixes the invisible white-on-white pane on main. With it, a Tahoe user gets a correctly colored layout bar, and if item images still cannot be cached they see a legible "Unable to display menu bar items" message instead of a blank white row. Making the item images themselves work on Tahoe is the larger rework that lives on the macos-26 branch (plus #922 for 26.4+), and is intentionally out of scope here.

Testing

  • The full module typechecks cleanly with the Swift 6.3 command line toolchain against the macOS 26.5 SDK with this change applied (no Xcode on the machine I used, so I could not run a full xcodebuild build; the only stubs needed were the Xcode-generated asset symbols and #Preview blocks).
  • The failure mechanism was verified by code inspection of the capture path and pixel analysis of the affected pane on macOS 26.5.2.
  • The composite capture approach is already validated on Tahoe by 0.11.13-dev.2, which uses the same technique.

The menu bar window is fully transparent on macOS 26, so the strip that
updateAverageColorInfo() captures has no pixels at or above the alpha
threshold. averageColor() then divides by a zero pixel count and returns
a CGColor with NaN components instead of nil. The NaN color renders the
layout bars solid white, and it also forces the "Unable to display menu
bar items" fallback text to white, leaving the whole pane blank white.

- Return nil from averageColor() when no pixels qualify
- Capture the menu bar window composited over the wallpaper window so
  the transparent menu bar picks up the wallpaper color behind it,
  matching the approach already used on the macos-26 branch
- Use .primary for the layout bar placeholder text when no average
  color is available, so it stays legible on Color.defaultLayoutBar
@Pranav-Karra-3301
Pranav-Karra-3301 force-pushed the fix-layout-bar-average-color branch from ac70003 to ef46185 Compare August 21, 2026 15:39
@Pranav-Karra-3301

Copy link
Copy Markdown
Author

@jordanbaird pinging in case this got buried. Small, self contained fix for the blank Menu Bar Layout pane on Tahoe that several open issues trace back to (#716, #891, #916, #743). It ports the composite capture approach you already use on macos-26 over to main and guards the NaN divide. Happy to rebase onto #967 if you'd rather take that guard separately, or adjust anything else.

@zouchao

zouchao commented Sep 1, 2026

Copy link
Copy Markdown

Hit the same issue. Could you please merge this PR?

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.

2 participants