Skip to content

Popover content stuck invisible (opacity 0) on slower Intel Macs from .popoverDidShow race #2

Description

@leitaoodavid

Summary

On slower machines, opening the popover shows only the background gradient. Every content section (header, system info cards, fan cards, footer) stays invisible.

Reproduced reliably on a 2018 Intel MacBook Pro (A1989), macOS 15.7. Does not reproduce on Apple Silicon.

Cause

All content sections in PopoverView are gated on appeared via .opacity(appeared ? 1 : 0), and appeared is only set to true inside the .onReceive(.popoverDidShow) handler.

In StatusBarController, .popoverDidShow is posted immediately after makeHostingController() / popover.show(...):

popover.contentViewController = makeHostingController()
popover.show(relativeTo: button.bounds, of: button, preferredEdge: .minY)
NSApp.activate(ignoringOtherApps: true)
popover.contentViewController?.view.window?.makeKeyAndOrderFront(nil)
NotificationCenter.default.post(name: .popoverDidShow, object: nil)

On slower hardware the notification is posted before SwiftUI mounts the view and registers .onReceive, so it is missed and appeared never becomes true, leaving all content at opacity 0 over the gradient. On Apple Silicon the view usually mounts fast enough to catch the notification, which is why it does not reproduce there.

Suggested fix

Also drive appeared from .onAppear, which fires reliably once the view appears, removing the timing dependency:

.onAppear {
    appeared = false
    DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
        appeared = true
    }
}

No behavior change where it already worked (same 0.05s delay and animation). Verified to fix the issue on the affected machine.

Environment

  • Model: MacBook Pro 13-inch 2018 (A1989), Intel
  • macOS: 15.7.7
  • ChillMac: 1.7.0 (built from source with Xcode 16.4 against the macOS 15.5 SDK)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions