Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Focus the terminal window open in the current space, or open a new one.
tell application "Terminal"
activate
set hasWindow to false
try
repeat with theWindow in windows
if (frontmost of theWindow) then
set hasWindow to true
end if
end repeat
end try
if (hasWindow is false) then
do script
end if
return hasWindow
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment