fix: closing alttab windows gives focus to previous app (closes #3577)

This commit is contained in:
lwouis
2024-08-30 18:30:39 +02:00
parent e890a603c2
commit 0e6f200efe
3 changed files with 18 additions and 0 deletions
+8
View File
@@ -189,3 +189,11 @@ extension Optional where Wrapped == String {
return (self ?? "").localizedStandardCompare(string ?? "")
}
}
extension NSWindow {
func hideAppIfLastWindowIsClosed() {
if (!NSApp.windows.contains { $0.isVisible && $0.className != "NSStatusBarWindow" && $0.windowNumber != windowNumber}) {
App.shared.hide(nil)
}
}
}
+5
View File
@@ -125,4 +125,9 @@ class FeedbackWindow: NSWindow {
}
return result
}
override func close() {
hideAppIfLastWindowIsClosed()
super.close()
}
}
@@ -96,4 +96,9 @@ class PreferencesWindow: NSWindow, NSToolbarDelegate {
func toolbarSelectableItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] {
return Array(toolbarItems.keys)
}
override func close() {
hideAppIfLastWindowIsClosed()
super.close()
}
}