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 {