@@ -10,17 +10,19 @@ public final class SpotlightWindowController {
1010 nonisolated static let panelStyleMask : NSWindow . StyleMask = [
1111 . borderless, . fullSizeContentView
1212 ]
13- /// `.statusBar` floats the HUD above any fullscreen Space. `.floating`
14- /// is below the menu-bar / fullscreen layer, so a fullscreen app
15- /// would hide the panel even when ordered front.
16- nonisolated static let panelLevel : NSWindow . Level = . statusBar
13+ /// `.screenSaver` keeps the HUD above the window layers used by
14+ /// fullscreen apps. Lower levels such as `.floating` and `.statusBar`
15+ /// can still be occluded by fullscreen windows on recent macOS
16+ /// releases even when the panel joins that Space.
17+ nonisolated static let panelLevel : NSWindow . Level = . screenSaver
1718 /// `.fullScreenAuxiliary` is the load-bearing flag -- it lets a panel
1819 /// appear in a fullscreen Space alongside the fullscreen app.
1920 /// `.canJoinAllSpaces` keeps the panel reachable from every Space,
20- /// and `.stationary` stops it being dragged along during Space
21- /// transitions (which would otherwise yank focus during the swipe).
21+ /// `.stationary` stops it being dragged along during Space
22+ /// transitions (which would otherwise yank focus during the swipe),
23+ /// and `.ignoresCycle` keeps this transient HUD out of Cmd-` cycling.
2224 nonisolated static let panelCollectionBehavior : NSWindow . CollectionBehavior = [
23- . canJoinAllSpaces, . fullScreenAuxiliary, . stationary
25+ . canJoinAllSpaces, . fullScreenAuxiliary, . stationary, . ignoresCycle
2426 ]
2527 nonisolated static let defaultUnfocusedAlpha : CGFloat = 0.55
2628
@@ -212,7 +214,7 @@ public final class SpotlightWindowController {
212214 focusOrShow ( )
213215 } else {
214216 NSApp . activate ( ignoringOtherApps: true )
215- panel? . makeKeyAndOrderFront ( nil )
217+ if let panel { bringPanelToFront ( panel ) }
216218 }
217219 if let mostRecent = session. chats. first {
218220 session. jump ( to: mostRecent)
@@ -258,10 +260,15 @@ public final class SpotlightWindowController {
258260 }
259261 panel. alphaValue = 1.0
260262 NSApp . activate ( ignoringOtherApps: true )
261- panel . makeKeyAndOrderFront ( nil )
263+ bringPanelToFront ( panel )
262264 focusTrigger. pulse ( )
263265 }
264266
267+ private func bringPanelToFront( _ panel: NSPanel ) {
268+ panel. makeKeyAndOrderFront ( nil )
269+ panel. orderFrontRegardless ( )
270+ }
271+
265272 private func repositionForShow( _ panel: NSPanel ) {
266273 guard let screen = NSScreen . main else { return }
267274 let screenFrame = screen. visibleFrame
@@ -292,15 +299,7 @@ public final class SpotlightWindowController {
292299 backing: . buffered,
293300 defer: false
294301 )
295- panel. isOpaque = false
296- panel. backgroundColor = . clear
297- panel. hasShadow = true
298- panel. level = Self . panelLevel
299- panel. isFloatingPanel = true
300- panel. hidesOnDeactivate = false
301- panel. becomesKeyOnlyIfNeeded = false
302- panel. isMovableByWindowBackground = true
303- panel. collectionBehavior = Self . panelCollectionBehavior
302+ Self . configurePanel ( panel)
304303 panel. contentView = NSHostingView (
305304 rootView: SpotlightRootView (
306305 focusTrigger: focusTrigger,
@@ -327,6 +326,18 @@ public final class SpotlightWindowController {
327326 return panel
328327 }
329328
329+ static func configurePanel( _ panel: NSPanel ) {
330+ panel. isOpaque = false
331+ panel. backgroundColor = . clear
332+ panel. hasShadow = true
333+ panel. isFloatingPanel = true
334+ panel. level = panelLevel
335+ panel. hidesOnDeactivate = false
336+ panel. becomesKeyOnlyIfNeeded = false
337+ panel. isMovableByWindowBackground = true
338+ panel. collectionBehavior = panelCollectionBehavior
339+ }
340+
330341 private static let driftCorrectionThreshold : CGFloat = 4
331342
332343 private func pinnedOrigin( for panel: NSPanel ) -> NSPoint ? {
0 commit comments