Skip to content

Instantly share code, notes, and snippets.

@cassler
Last active December 19, 2016 20:55
Show Gist options
  • Save cassler/6aa8709739988c20c9358c2a6edcc1b6 to your computer and use it in GitHub Desktop.
Save cassler/6aa8709739988c20c9358c2a6edcc1b6 to your computer and use it in GitHub Desktop.

Toggle Application Service

This script can be assigned a keyboard shortcut as a System Service to toggle visibility. Just change appName to whatever suits you

set appName to "Hyper"
set startIt to false
tell application "System Events"
if not (exists process appName) then
set startIt to true
else if frontmost of process appName then
set visible of process appName to false
else
set frontmost of process appName to true
end if
end tell
if startIt then
tell application appName to activate
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment