Fix activation policy being reapplied unnecessarily during app switching

This commit is contained in:
Beingpax 2025-11-08 20:11:37 +05:45
parent e5e194de5f
commit ba68ec429c
2 changed files with 2 additions and 8 deletions

View File

@ -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
} }

View File

@ -44,7 +44,7 @@ class MenuBarManager: ObservableObject {
WindowManager.shared.showMainWindow() WindowManager.shared.showMainWindow()
} }
} }
if Thread.isMainThread { if Thread.isMainThread {
applyPolicy() applyPolicy()
} else { } else {