Skip to content

Instantly share code, notes, and snippets.

@mikew
Created March 14, 2019 13:56
Show Gist options
  • Save mikew/d75c2dbb636dd5ba81d6be960540f905 to your computer and use it in GitHub Desktop.
Save mikew/d75c2dbb636dd5ba81d6be960540f905 to your computer and use it in GitHub Desktop.
on run argv
set appToLaunch to (item 1 of argv)
tell application "System Events"
set activeApp to bundle identifier of first process whose frontmost is true
end tell
if appToLaunch is equal to activeApp then
tell application "System Events" to keystroke "`" using command down
else
do shell script "open -b " & appToLaunch
end if
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment