File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 7
7
//
8
8
9
9
import Foundation
10
+ import Cocoa
10
11
import MASShortcut
11
12
12
13
struct ShortcutMonitor {
@@ -22,7 +23,18 @@ struct ShortcutMonitor {
22
23
frontmostAppIdentifier == targetAppIdentifier {
23
24
NSRunningApplication . runningApplications ( withBundleIdentifier: frontmostAppIdentifier) . first? . hide ( )
24
25
} else {
25
- NSWorkspace . shared. launchApplication ( app. appName)
26
+ if #available( macOS 10 . 15 , * ) {
27
+ let configuration = NSWorkspace . OpenConfiguration ( )
28
+ configuration. activates = true
29
+ NSWorkspace . shared. openApplication ( at: app. appBundleURL,
30
+ configuration: configuration) { _, error in
31
+ if let error = error {
32
+ NSLog ( " ERROR: \( error) " )
33
+ }
34
+ }
35
+ } else {
36
+ NSWorkspace . shared. launchApplication ( app. appName)
37
+ }
26
38
}
27
39
} )
28
40
}
You can’t perform that action at this time.
0 commit comments