Skip to content

Instantly share code, notes, and snippets.

@yqrashawn
Created December 29, 2016 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yqrashawn/e4470786005308b198002b14a348790c to your computer and use it in GitHub Desktop.
Save yqrashawn/e4470786005308b198002b14a348790c to your computer and use it in GitHub Desktop.
apple script toggle application visibility
set appName to "Emacs"
set appID to bundle identifier of (info for (path to application appName))
tell application "System Events"
if not (exists process appName) then
tell application appID to activate
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 if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment