Skip to content

Commit

Permalink
NC: add search action
Browse files Browse the repository at this point in the history
  • Loading branch information
zhen-zen committed Oct 17, 2020
1 parent 919d721 commit be295da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion YogaSMCNC/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,11 @@ func notificationCallback(_ port: CFMachPort?, _ msg: UnsafeMutableRawPointer?,

enum eventAction : String {
// Userspace
case nothing, script, micmute, camera, airplane, wireless, bluetooth, bluetoothdiscoverable, prefpane, mirror, spotlight, mission, launchpad, desktop, expose, sleep
case nothing, script
case airplane, wireless, bluetooth, bluetoothdiscoverable
case prefpane, spotlight, search, sleep, micmute
case mission, launchpad, desktop, expose
case mirror, camera
// Driver
case backlight, keyboard, thermal
}
Expand Down Expand Up @@ -366,6 +370,9 @@ func eventActuator(_ desc: eventDesc, _ data: UInt32, _ conf: UnsafePointer<shar
}
_ = scriptHelper(sleepAS, desc.name)
return
case .search:
_ = scriptHelper(searchAS, desc.name)
return
case .spotlight:
_ = scriptHelper(spotlightAS, desc.name)
return
Expand Down
3 changes: 2 additions & 1 deletion YogaSMCUtils/ScriptHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ let prefpaneAS = """
"""
let sleepAS = "tell application \"System Events\" to sleep"

let spotlightAS = "tell application \"System Events\" to keystroke space using {command down, option down}"
let searchAS = "tell application \"System Events\" to keystroke space using {command down, option down}"
let spotlightAS = "tell application \"System Events\" to keystroke space using {command down}"

let getAudioMutedAS = "output muted of (get volume settings)"
let setAudioMuteAS = "set volume with output muted"
Expand Down

0 comments on commit be295da

Please sign in to comment.