Skip to content

Commit 644489f

Browse files
committed
Improve chat panel always on top behavior
1 parent 8194a7d commit 644489f

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

Core/Sources/HostApp/FeatureSettings/ChatSettingsView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,12 @@ struct ChatSettingsView: View {
171171
#endif
172172

173173
Toggle(isOn: $settings.disableFloatOnTopWhenTheChatPanelIsDetached) {
174-
Text("Disable float on top when the chat panel is detached")
174+
Text("Disable always-on-top when the chat panel is detached")
175175
}
176176

177177
Toggle(isOn: $settings.keepFloatOnTopIfChatPanelAndXcodeOverlaps) {
178-
Text("But, keep float on top if chat panel and Xcode overlaps")
179-
}
178+
Text("Keep always-on-top if the chat panel and Xcode overlaps and Xcode is active")
179+
}.disabled(!settings.disableFloatOnTopWhenTheChatPanelIsDetached)
180180
}
181181
}
182182

Core/Sources/SuggestionWidget/WidgetWindowsController.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ private extension WidgetWindowsController {
8989
updateWindowLocation(animated: false, immediately: false)
9090
await hideSuggestionPanelWindow()
9191
}
92+
await adjustChatPanelWindowLevel()
9293
}
9394
guard currentApplicationProcessIdentifier != app.processIdentifier else { return }
9495
currentApplicationProcessIdentifier = app.processIdentifier
@@ -462,7 +463,7 @@ extension WidgetWindowsController {
462463
animate: animated
463464
)
464465
}
465-
466+
466467
await adjustChatPanelWindowLevel()
467468
}
468469

@@ -514,7 +515,14 @@ extension WidgetWindowsController {
514515
let floatOnTopWhenOverlapsXcode = UserDefaults.shared
515516
.value(for: \.keepFloatOnTopIfChatPanelAndXcodeOverlaps)
516517

517-
if !floatOnTopWhenOverlapsXcode {
518+
let latestApp = await xcodeInspector.safe.activeApplication
519+
let latestAppIsXcodeOrExtension = if let latestApp {
520+
latestApp.isXcode || latestApp.isExtensionService
521+
} else {
522+
false
523+
}
524+
525+
if !floatOnTopWhenOverlapsXcode || !latestAppIsXcodeOrExtension {
518526
window.setFloatOnTop(false)
519527
} else {
520528
guard let xcode = await xcodeInspector.safe.latestActiveXcode else { return }

0 commit comments

Comments
 (0)