| | |
| | | static let theme = "theme" |
| | | static let tags = "tags" |
| | | static let data = "data" |
| | | static let about = "about" |
| | | } |
| | | |
| | | // MARK: - Edit Phase |
| | |
| | | closeQuickSearch(hideOverlayIfNeeded: true) |
| | | hideOverlay() |
| | | } |
| | | if isCurrentApp(app) { |
| | | if closeQuickSearchOnSuccess && !closeQuickSearchAndOverlayBeforeOpening { |
| | | closeQuickSearch(hideOverlayIfNeeded: closeOverlayOnSuccess) |
| | | } |
| | | if closeOverlayOnSuccess && !closeQuickSearchAndOverlayBeforeOpening { |
| | | hideOverlay() |
| | | } |
| | | return |
| | | } |
| | | let configuration = NSWorkspace.OpenConfiguration() |
| | | NSWorkspace.shared.openApplication(at: app.path, configuration: configuration) { _, error in |
| | | DispatchQueue.main.async { |
| | |
| | | } |
| | | } |
| | | |
| | | private func isCurrentApp(_ app: AppInfo) -> Bool { |
| | | if app.bundleIdentifier?.caseInsensitiveCompare(AppIdentity.bundleIdentifier) == .orderedSame { |
| | | return true |
| | | } |
| | | |
| | | let currentURL = Bundle.main.bundleURL.standardizedFileURL.resolvingSymlinksInPath() |
| | | let appURL = app.path.standardizedFileURL.resolvingSymlinksInPath() |
| | | return currentURL == appURL |
| | | } |
| | | |
| | | func openApp(_ app: AppInfo) { |
| | | hideOverlay() |
| | | launchApp(app, closeOverlayOnSuccess: false) |