@@ -159,7 +159,7 @@ private extension WidgetWindowsController {
159159 updateWindowLocation(animated: false, immediately: immediately)
160160 updateWindowOpacity(immediately: immediately)
161161 }
162-
162+
163163 await updateWidgetsAndNotifyChangeOfEditor(immediately: true)
164164
165165 for await notification in await notifications.notifications() {
@@ -274,7 +274,8 @@ extension WidgetWindowsController {
274274 let parent = focusElement.parent,
275275 let frame = parent.rect,
276276 let screen = NSScreen.screens.first(where: { $0.frame.origin == .zero }),
277- let firstScreen = NSScreen.main
277+ let windowContainingScreen = NSScreen.screens
278+ .first(where: { $0.frame.contains(frame.origin) })
278279 {
279280 let positionMode = UserDefaults.shared
280281 .value(for: \. suggestionWidgetPositionMode)
@@ -286,15 +287,15 @@ extension WidgetWindowsController {
286287 var result = UpdateLocationStrategy . FixedToBottom ( ) . framesForWindows (
287288 editorFrame: frame,
288289 mainScreen: screen,
289- activeScreen: firstScreen
290+ activeScreen: windowContainingScreen
290291 )
291292 switch suggestionMode {
292293 case . nearbyTextCursor:
293294 result. suggestionPanelLocation = UpdateLocationStrategy
294295 . NearbyTextCursor ( )
295296 . framesForSuggestionWindow (
296297 editorFrame: frame, mainScreen: screen,
297- activeScreen: firstScreen ,
298+ activeScreen: windowContainingScreen ,
298299 editor: focusElement,
299300 completionPanel: xcodeInspector. completionPanel
300301 )
@@ -306,7 +307,7 @@ extension WidgetWindowsController {
306307 var result = UpdateLocationStrategy . AlignToTextCursor ( ) . framesForWindows (
307308 editorFrame: frame,
308309 mainScreen: screen,
309- activeScreen: firstScreen ,
310+ activeScreen: windowContainingScreen ,
310311 editor: focusElement
311312 )
312313 switch suggestionMode {
@@ -315,7 +316,7 @@ extension WidgetWindowsController {
315316 . NearbyTextCursor ( )
316317 . framesForSuggestionWindow (
317318 editorFrame: frame, mainScreen: screen,
318- activeScreen: firstScreen ,
319+ activeScreen: windowContainingScreen ,
319320 editor: focusElement,
320321 completionPanel: xcodeInspector. completionPanel
321322 )
@@ -395,8 +396,6 @@ extension WidgetWindowsController {
395396 let latestActiveXcode = await xcodeInspector. safe. latestActiveXcode
396397 let previousActiveApplication = xcodeInspector. previousActiveApplication
397398 await MainActor . run {
398- let state = store. withState { $0 }
399-
400399 if let activeApp, activeApp. isXcode {
401400 let application = activeApp. appElement
402401 /// We need this to hide the windows when Xcode is minimized.
@@ -875,7 +874,7 @@ class WidgetWindow: CanBecomeKeyWindow {
875874 case normal( fullscreen: Bool )
876875 case switchingSpace
877876 }
878-
877+
879878 var hoveringLevel : NSWindow . Level = widgetLevel ( 0 )
880879
881880 var defaultCollectionBehavior : NSWindow . CollectionBehavior {
0 commit comments