Fix activation policy being reapplied unnecessarily during app switching
This commit is contained in:
parent
e5e194de5f
commit
ba68ec429c
@ -10,8 +10,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
|
func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
|
||||||
menuBarManager?.applyActivationPolicy()
|
|
||||||
|
|
||||||
if !flag, let menuBarManager = menuBarManager, !menuBarManager.isMenuBarOnly {
|
if !flag, let menuBarManager = menuBarManager, !menuBarManager.isMenuBarOnly {
|
||||||
if WindowManager.shared.showMainWindow() != nil {
|
if WindowManager.shared.showMainWindow() != nil {
|
||||||
return false
|
return false
|
||||||
@ -19,11 +17,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func applicationDidBecomeActive(_ notification: Notification) {
|
|
||||||
menuBarManager?.applyActivationPolicy()
|
|
||||||
}
|
|
||||||
|
|
||||||
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,7 @@ class MenuBarManager: ObservableObject {
|
|||||||
WindowManager.shared.showMainWindow()
|
WindowManager.shared.showMainWindow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if Thread.isMainThread {
|
if Thread.isMainThread {
|
||||||
applyPolicy()
|
applyPolicy()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user