diff --git a/Passepartout/Launcher/AppDelegate.swift b/Passepartout/Launcher/AppDelegate.swift index 7aaf165d..a32d7fe9 100644 --- a/Passepartout/Launcher/AppDelegate.swift +++ b/Passepartout/Launcher/AppDelegate.swift @@ -42,7 +42,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject { } Task { do { - try await NSWorkspace.shared.openApplication(at: appURL, configuration: .init()) + let cfg = NSWorkspace.OpenConfiguration() + cfg.hides = true + try await NSWorkspace.shared.openApplication(at: appURL, configuration: cfg) } catch { NSLog("Unable to launch main app: \(error)") } diff --git a/Passepartout/Launcher/Constants/Constants+Launcher.swift b/Passepartout/Launcher/Constants/Constants+Launcher.swift index a38e1f60..44618dea 100644 --- a/Passepartout/Launcher/Constants/Constants+Launcher.swift +++ b/Passepartout/Launcher/Constants/Constants+Launcher.swift @@ -29,16 +29,13 @@ extension Constants { enum Launcher { static let appId = "com.algoritmico.ios.Passepartout" - static let appURL: URL = { - let url = URL(fileURLWithPath: Bundle.main.bundlePath) - var components = url.pathComponents - components.removeLast() - components.removeLast() - components.removeLast() - components.append("MacOS") - components.append(Constants.Global.appName) - let newPath = NSString.path(withComponents: components) - return URL(fileURLWithPath: newPath) + private static let appPath: String = { + let path = Bundle.main.bundlePath as NSString + var components = path.pathComponents + components.removeLast(4) + return NSString.path(withComponents: components) }() + + static let appURL = URL(fileURLWithPath: appPath) } }