Skip to content

Commit 3f1e1d9

Browse files
committed
Return focus to previous app even if there are mulitple menu windows
Sometimes when Maccy menu pops up, it reports there are 2 visible menu windows. A regular "Item-0" window that is Maccy menu and some additional titleless NSStatusBarWindow. I have zero ideas where it's coming from but some users reported this. In any event, we should return focus to the previous application regardless how many menu bar windows are visible at the moment. Fixes #144
1 parent eda9053 commit 3f1e1d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Maccy/Maccy.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class Maccy: NSObject {
1616
private var window: NSWindow!
1717
@objc private var menuLink: NSStatusItem!
1818

19-
private let carbonMenuWindowTitle = "Item-0"
19+
private let carbonMenuWindowClass = "NSStatusBarWindow"
2020
private var extraVisibleWindows: [NSWindow] {
21-
return NSApp.windows.filter({ $0.isVisible && $0.title != carbonMenuWindowTitle })
21+
return NSApp.windows.filter({ $0.isVisible && String(describing: type(of: $0)) != carbonMenuWindowClass })
2222
}
2323

2424
private lazy var preferencesWindowController = PreferencesWindowController(

0 commit comments

Comments
 (0)