Skip to content

Commit

Permalink
Merge pull request #39 from kenji21/master
Browse files Browse the repository at this point in the history
Use newer APIs to launch applications to fix issue #38
  • Loading branch information
gbammc authored May 16, 2021
2 parents 8b18fe6 + d404f4f commit a6773a5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Thor/ShortcutMonitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Foundation
import Cocoa
import MASShortcut

struct ShortcutMonitor {
Expand All @@ -22,7 +23,18 @@ struct ShortcutMonitor {
frontmostAppIdentifier == targetAppIdentifier {
NSRunningApplication.runningApplications(withBundleIdentifier: frontmostAppIdentifier).first?.hide()
} else {
NSWorkspace.shared.launchApplication(app.appName)
if #available(macOS 10.15, *) {
let configuration = NSWorkspace.OpenConfiguration()
configuration.activates = true
NSWorkspace.shared.openApplication(at: app.appBundleURL,
configuration: configuration) { _, error in
if let error = error {
NSLog("ERROR: \(error)")
}
}
} else {
NSWorkspace.shared.launchApplication(app.appName)
}
}
})
}
Expand Down

0 comments on commit a6773a5

Please sign in to comment.