Created
November 20, 2012 20:04
-
-
Save jerith/4120666 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----------------------------------------------------------------------------- | |
-- This script creates a new terminal window. | |
-- | |
-- If you disable "When switching to an application, switch to a space with | |
-- open windows" in the Spaces preferences, the new terminal window will | |
-- appear on the current workspace. | |
-- | |
-- Terminal.app creates a new window on startup, so we need to check if it's | |
-- already running and not create an extra window in that case. | |
----------------------------------------------------------------------------- | |
-- if application "Terminal" is running then | |
-- activate application "Terminal" | |
-- tell application "System Events" | |
-- tell process "Terminal" | |
-- click menu item "New Window" of menu "Shell" of menu bar 1 | |
-- end tell | |
-- end tell | |
-- else | |
-- -- Starting Terminal creates a new window | |
-- activate application "Terminal" | |
-- end if | |
----------------------------------------------------------------------------- | |
-- Pretty much as above, except using iTerm. | |
----------------------------------------------------------------------------- | |
if application "iTerm" is running then | |
tell application "iTerm" | |
set myterm to (make new terminal) | |
tell myterm | |
launch session "Default Session" | |
end tell | |
activate current session | |
end tell | |
else | |
activate application "iTerm" | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment