fix(mac): the Capacity Dock popover appears inside a full-screen space

Every window belongs to a set of spaces. The rail belongs to all of them;
the detail panel had been reduced to the desktop space alone, so hovering a
pill inside a full-screen app positioned the popover, faded it in and
ordered it front exactly as it does on the desktop, in a space the user was
not looking at. Measured on a running instance: the rail reported
spaces=[3, 63, 24, 137] with 137 active, the panel reported spaces=[3].

The membership is written once in init and never again. The window server
drops it across a display sleep or a display reconfiguration, and the rail
survives only because it is never ordered out. Re-assert it in showDetail,
the one funnel every presentation passes through. It has to be written, not
read and compared: assigning collectionBehavior is what re-registers the
window, and it must happen while the window is ordered out.

Also drop a duplicate `isFloatingPanel = true` that ran after the shielding
level was set. NSPanel.isFloatingPanel writes level = .floating, so the
second assignment silently discarded the level the comment above it asks
for: the dock measured at layer 3 instead of 2147483628, low enough for any
floating window to cover it. Both panels now report the shielding level.
This commit is contained in:
iamtoruk 2026-09-03 06:07:45 -07:00
parent 3517f7c928
commit a1cc32663f

View file

@ -559,6 +559,10 @@ final class CapacityDockController {
model.detailHeight = glanceDetailHeight(for: provider)
ensureDetailPanel()
layoutDetail(for: provider, transaction: wasShowingDetail ? .detailFollow : .detailPresent)
// A panel that lost its all-spaces membership returns to the desktop space alone,
// so hovering inside a full-screen app presented the popover where it could not be
// seen. The rail escapes this by never being ordered out.
detailPanel?.reassertSpaceMembership()
detailPanel?.orderFrontRegardless()
}
@ -1384,11 +1388,21 @@ private final class CapacityDockPanel: NSPanel {
hidesOnDeactivate = false
isReleasedWhenClosed = false
isMovable = false
isFloatingPanel = true
isExcludedFromWindowsMenu = true
becomesKeyOnlyIfNeeded = true
animationBehavior = .none
collectionBehavior = [.canJoinAllSpaces, .stationary, .fullScreenAuxiliary, .ignoresCycle]
collectionBehavior = Self.spaceBehavior
}
/// Membership of every space, including the one a full-screen app owns. The window
/// server drops it from a panel across a display sleep or a display reconfiguration,
/// and writing it again is what re-registers the window, so this is re-asserted
/// before each presentation rather than only at init.
static let spaceBehavior: NSWindow.CollectionBehavior =
[.canJoinAllSpaces, .stationary, .fullScreenAuxiliary, .ignoresCycle]
func reassertSpaceMembership() {
collectionBehavior = Self.spaceBehavior
}
override var canBecomeKey: Bool { false }