Skip to content

Commit 4a1ab57

Browse files
committed
Fix that the widget can't follow Xcode to another space
1 parent 35e291d commit 4a1ab57

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

Core/Sources/SuggestionWidget/SuggestionWidgetController.swift

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,11 @@ public final class SuggestionWidgetController: NSObject {
172172
if app != previousApp {
173173
windowChangeObservationTask?.cancel()
174174
windowChangeObservationTask = nil
175-
self.observeXcodeWindowChangeIfNeeded(app)
175+
observeXcodeWindowChangeIfNeeded(app)
176176
}
177-
await self.updateContentForActiveEditor()
178-
self.updateWindowLocation()
177+
await updateContentForActiveEditor()
178+
updateWindowLocation()
179+
orderFront()
179180
} else {
180181
if ActiveApplicationMonitor.activeApplication?.bundleIdentifier != Bundle
181182
.main.bundleIdentifier
@@ -203,11 +204,8 @@ public final class SuggestionWidgetController: NSObject {
203204
guard let activeXcode = ActiveApplicationMonitor.activeXcode else { continue }
204205
guard fullscreenDetector.isOnActiveSpace else { continue }
205206
let app = AXUIElementCreateApplication(activeXcode.processIdentifier)
206-
if let window = app.focusedWindow, window.isFullScreen {
207-
widgetWindow.orderFrontRegardless()
208-
tabWindow.orderFrontRegardless()
209-
panelWindow.orderFrontRegardless()
210-
chatWindow.orderFrontRegardless()
207+
if let window = app.focusedWindow {
208+
orderFront()
211209
}
212210
}
213211
}
@@ -263,6 +261,13 @@ public final class SuggestionWidgetController: NSObject {
263261
}
264262
}
265263
}
264+
265+
func orderFront() {
266+
widgetWindow.orderFrontRegardless()
267+
tabWindow.orderFrontRegardless()
268+
panelWindow.orderFrontRegardless()
269+
chatWindow.orderFrontRegardless()
270+
}
266271
}
267272

268273
// MARK: - Handle Events

0 commit comments

Comments
 (0)