From ba68ec429c0f0fcffd1597e65fb55386b202e42b Mon Sep 17 00:00:00 2001 From: Beingpax Date: Sat, 8 Nov 2025 20:11:37 +0545 Subject: [PATCH] Fix activation policy being reapplied unnecessarily during app switching --- VoiceInk/AppDelegate.swift | 8 +------- VoiceInk/MenuBarManager.swift | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/VoiceInk/AppDelegate.swift b/VoiceInk/AppDelegate.swift index 486f087..3c7474c 100644 --- a/VoiceInk/AppDelegate.swift +++ b/VoiceInk/AppDelegate.swift @@ -10,8 +10,6 @@ class AppDelegate: NSObject, NSApplicationDelegate { } func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool { - menuBarManager?.applyActivationPolicy() - if !flag, let menuBarManager = menuBarManager, !menuBarManager.isMenuBarOnly { if WindowManager.shared.showMainWindow() != nil { return false @@ -19,11 +17,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { } return true } - - func applicationDidBecomeActive(_ notification: Notification) { - menuBarManager?.applyActivationPolicy() - } - + func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { return false } diff --git a/VoiceInk/MenuBarManager.swift b/VoiceInk/MenuBarManager.swift index 2a92b58..e9aede1 100644 --- a/VoiceInk/MenuBarManager.swift +++ b/VoiceInk/MenuBarManager.swift @@ -44,7 +44,7 @@ class MenuBarManager: ObservableObject { WindowManager.shared.showMainWindow() } } - + if Thread.isMainThread { applyPolicy() } else {