Skip to content

Commit 863459c

Browse files
committed
Center chat panel when force detached and Xcode is not active
1 parent 27151c9 commit 863459c

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

Core/Sources/SuggestionWidget/ChatPanelWindow.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ final class ChatPanelWindow: WidgetWindow {
9494
}
9595
}
9696
}
97+
98+
func centerInActiveSpaceIfNeeded() {
99+
guard !isOnActiveSpace else { return }
100+
center()
101+
}
97102

98103
func setFloatOnTop(_ isFloatOnTop: Bool) {
99104
let targetLevel: NSWindow.Level = isFloatOnTop

Core/Sources/SuggestionWidget/FeatureReducers/ChatPanelFeature.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public struct ChatPanelFeature {
125125
await send(.attachChatPanel)
126126
}
127127
}
128-
128+
129129
state.isDetached.toggle()
130130
return .none
131131

@@ -161,6 +161,11 @@ public struct ChatPanelFeature {
161161
}
162162
state.isPanelDisplayed = true
163163
return .run { send in
164+
if forceDetach {
165+
await suggestionWidgetControllerDependency.windowsController?.windows
166+
.chatPanelWindow
167+
.centerInActiveSpaceIfNeeded()
168+
}
164169
activateExtensionService()
165170
await send(.focusActiveChatTab)
166171
}

0 commit comments

Comments
 (0)