From e5d8152cb6be71b2f32432f0abea82c1653b2e78 Mon Sep 17 00:00:00 2001 From: Shx Guo Date: Fri, 23 Jun 2023 15:55:26 +0800 Subject: [PATCH] Fix that the widget will be brought to front when switching spaces --- .../SuggestionWidgetController.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Core/Sources/SuggestionWidget/SuggestionWidgetController.swift b/Core/Sources/SuggestionWidget/SuggestionWidgetController.swift index 2d61fe16e..a50727788 100644 --- a/Core/Sources/SuggestionWidget/SuggestionWidgetController.swift +++ b/Core/Sources/SuggestionWidget/SuggestionWidgetController.swift @@ -39,7 +39,7 @@ public final class SuggestionWidgetController: NSObject { it.isOpaque = false it.backgroundColor = .clear it.level = .init(19) - it.collectionBehavior = [.fullScreenAuxiliary] + it.collectionBehavior = [.fullScreenAuxiliary, .transient] it.hasShadow = true it.contentView = NSHostingView( rootView: WidgetView( @@ -72,7 +72,7 @@ public final class SuggestionWidgetController: NSObject { it.isOpaque = false it.backgroundColor = .clear it.level = .init(19) - it.collectionBehavior = [.fullScreenAuxiliary] + it.collectionBehavior = [.fullScreenAuxiliary, .transient] it.hasShadow = true it.contentView = NSHostingView( rootView: TabView(chatWindowViewModel: chatWindowViewModel) @@ -93,7 +93,7 @@ public final class SuggestionWidgetController: NSObject { it.isOpaque = false it.backgroundColor = .clear it.level = .init(NSWindow.Level.floating.rawValue + 1) - it.collectionBehavior = [.fullScreenAuxiliary] + it.collectionBehavior = [.fullScreenAuxiliary, .transient] it.hasShadow = true it.contentView = NSHostingView( rootView: SharedPanelView( @@ -120,7 +120,7 @@ public final class SuggestionWidgetController: NSObject { it.isOpaque = false it.backgroundColor = .clear it.level = .init(NSWindow.Level.floating.rawValue + 1) - it.collectionBehavior = [.fullScreenAuxiliary] + it.collectionBehavior = [.fullScreenAuxiliary, .transient] it.hasShadow = true it.contentView = NSHostingView( rootView: SuggestionPanelView( @@ -147,7 +147,7 @@ public final class SuggestionWidgetController: NSObject { it.isOpaque = false it.backgroundColor = .clear it.level = .floating - it.collectionBehavior = [.fullScreenAuxiliary] + it.collectionBehavior = [.fullScreenAuxiliary, .transient] it.hasShadow = true it.contentView = NSHostingView( rootView: ChatWindowView(viewModel: chatWindowViewModel) @@ -240,7 +240,7 @@ public final class SuggestionWidgetController: NSObject { guard let activeXcode = ActiveApplicationMonitor.activeXcode else { continue } guard fullscreenDetector.isOnActiveSpace else { continue } let app = AXUIElementCreateApplication(activeXcode.processIdentifier) - if app.focusedWindow != nil { + if let window = app.focusedWindow, window.isFullScreen { orderFront() } }