mirror of
https://github.com/lwouis/alt-tab-macos.git
synced 2026-05-24 11:20:36 +00:00
fix: closing alttab windows gives focus to previous app (closes #3577)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user