Skip to content

Instantly share code, notes, and snippets.

@mkhl
Created November 28, 2008 20:44
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 mkhl/30086 to your computer and use it in GitHub Desktop.
Save mkhl/30086 to your computer and use it in GitHub Desktop.
When using Terminal.app, hide it, otherwise switch to it
tell application "System Events"
if exists application process "Terminal" then
set terminalProcess to application process "Terminal"
if frontmost of terminalProcess then
tell terminalProcess to set visible to false
else
tell terminalProcess to set frontmost to true
end if
else
tell application "Terminal"
launch
activate
end tell
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment