From dd1a62324eb13823d6d2f98b613478651d40ac47 Mon Sep 17 00:00:00 2001 From: hatimhtm <106043141+hatimhtm@users.noreply.github.com> Date: Sat, 21 Mar 2026 10:44:53 +0000 Subject: [PATCH] perf: Hoist appDict lookup outside of runningApps loop Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- Click2Minimize/AppDelegate.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Click2Minimize/AppDelegate.swift b/Click2Minimize/AppDelegate.swift index 55a4109..3ec6ed9 100644 --- a/Click2Minimize/AppDelegate.swift +++ b/Click2Minimize/AppDelegate.swift @@ -189,8 +189,9 @@ class AppDelegate: NSObject, NSApplicationDelegate { } // Find the running application by name using NSWorkspace let runningApps = NSWorkspace.shared.runningApplications + let mappedAppID = appDelegate.appDict[dockItem.appID] if let app = runningApps.first(where: { $0.localizedName == dockItem.appID - || $0.localizedName == appDelegate.appDict[dockItem.appID] }) { + || $0.localizedName == mappedAppID }) { print("App isHidden: \(app.isHidden), isActive: \(app.isActive)") // Check if it's active and has unminimized windows if app.isActive && !app.isHidden {