Skip to content

Commit 51d0a08

Browse files
committed
Make activationPolicy more reliable
1 parent 0869b81 commit 51d0a08

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

Core/Sources/SuggestionWidget/SuggestionPanelView.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ final class SuggestionPanelViewModel: ObservableObject {
4141

4242
@Published var activeTab: ActiveTab {
4343
didSet {
44-
if activeTab != oldValue {
45-
onActiveTabChanged?(activeTab)
46-
}
44+
onActiveTabChanged?(activeTab)
4745
}
4846
}
4947

Core/Sources/SuggestionWidget/SuggestionWidgetController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ public final class SuggestionWidgetController {
225225
Currently, we have to make the app an accessory so that we can type things in the chat mode.
226226
But in other modes, we want to keep it prohibited so the helper app won't take over the focus.
227227
""")
228-
if case .chat = activeTab {
228+
if case .chat = activeTab, NSApp.activationPolicy() != .accessory {
229229
NSApp.setActivationPolicy(.accessory)
230-
} else {
230+
} else if NSApp.activationPolicy() != .prohibited {
231231
Task {
232232
try await Environment.makeXcodeActive()
233233
NSApp.setActivationPolicy(.prohibited)

0 commit comments

Comments
 (0)