From 1a3e52efc8a90cda229a87c0a90afac2c6123995 Mon Sep 17 00:00:00 2001 From: igor Date: Mon, 17 Mar 2025 18:18:58 -0700 Subject: [PATCH] Now the search doesn't appear when launched by 'start at login'. --- src/AppDelegate.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/AppDelegate.swift b/src/AppDelegate.swift index 3da7939..7229a1b 100644 --- a/src/AppDelegate.swift +++ b/src/AppDelegate.swift @@ -15,7 +15,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate { window.delegate = self - window.makeKeyAndOrderFront(nil) + // NOTE: Here we check wether the program was launched by the system. If it was not, then display the window. + if let event = NSAppleEventManager.shared().currentAppleEvent, + !(event.eventID == kAEOpenApplication && event.paramDescriptor(forKeyword: keyAEPropData)?.enumCodeValue == keyAELaunchedAsLogInItem) + { + window.makeKeyAndOrderFront(nil) + } HotKeyManager.shared.handler = { (inHandlerCallRef, inEvent, inUserData) -> OSStatus in if let delegate = NSApplication.shared.delegate as? AppDelegate {