diff --git a/Pine/AppDelegate.swift b/Pine/AppDelegate.swift index 99d7396..450d021 100644 --- a/Pine/AppDelegate.swift +++ b/Pine/AppDelegate.swift @@ -94,6 +94,8 @@ class AppDelegate: NSObject, NSApplicationDelegate { completionHandler: { _,_,_ in } ) } + + Utils.getCurrentMainWindowController()?.window?.makeKeyAndOrderFront(nil) } } } diff --git a/Pine/Helpers/Utils.swift b/Pine/Helpers/Utils.swift index 636d44a..c9188b8 100644 --- a/Pine/Helpers/Utils.swift +++ b/Pine/Helpers/Utils.swift @@ -13,6 +13,10 @@ class Utils { /// The current main window controller of the application public static func getCurrentMainWindowController() -> PineWindowController? { + if let keyWindow = NSApp.keyWindow, keyWindow.isVisible { + return keyWindow.windowController as? PineWindowController + } + return NSApp.windows.filter({ $0.isVisible }).first?.windowController as? PineWindowController }