Skip to content

Commit 473f88f

Browse files
committed
Fix that widget not hidden when Xcode in minimized
1 parent 1220279 commit 473f88f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Core/Sources/SuggestionWidget/SuggestionWidgetController.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -555,14 +555,17 @@ extension SuggestionWidgetController {
555555
}
556556

557557
if let app = ActiveApplicationMonitor.activeApplication, app.isXcode {
558-
panelWindow.alphaValue = 1
559-
widgetWindow.alphaValue = 1
560-
tabWindow.alphaValue = 1
558+
let application = AXUIElementCreateApplication(app.processIdentifier)
559+
/// We need this to hide the windows when Xcode is minimized.
560+
let noFocus = application.focusedWindow == nil
561+
panelWindow.alphaValue = noFocus ? 0 : 1
562+
widgetWindow.alphaValue = noFocus ? 0 : 1
563+
tabWindow.alphaValue = noFocus ? 0 : 1
561564

562565
if detachChat {
563566
chatWindow.alphaValue = chatWindowViewModel.chat != nil ? 1 : 0
564567
} else {
565-
chatWindow.alphaValue = 1
568+
chatWindow.alphaValue = noFocus ? 0 : 1
566569
}
567570
} else if let app = ActiveApplicationMonitor.activeApplication,
568571
app.bundleIdentifier == Bundle.main.bundleIdentifier

0 commit comments

Comments
 (0)