Skip to content

Instantly share code, notes, and snippets.

@jasonmay
Created February 26, 2010 01:05
Show Gist options
  • Save jasonmay/315277 to your computer and use it in GitHub Desktop.
Save jasonmay/315277 to your computer and use it in GitHub Desktop.
AppleScript to open four iTerms along the center of the screen instead of the corners
tell application "iTerm"
set gap to 4
set mw to 640
set mh to 400
set top_left to (make new terminal)
tell top_left
launch session "Default"
end tell
-- make some variables with data gathered from the first term
set {x1, y1, x2, y2} to bounds of the first window
set h to y2 - y1
set w to x2 - x1
set the bounds of the first window to {mw - w - gap, mh - h - gap, mw - gap, mh - gap}
--------------------------------------------------------------
set top_right to (make new terminal)
tell top_right
launch session "Default"
end tell
set the bounds of the first window to {mw + gap, mh - h - gap, mw + w + gap, mh - gap}
--------------------------------------------------------------
set bottom_left to (make new terminal)
tell bottom_left
launch session "Default"
end tell
set the bounds of the first window to {mw - w - gap, mh + gap, mw - gap, mh + h + gap}
--------------------------------------------------------------
set bottom_right to (make new terminal)
tell bottom_right
launch session "Default"
end tell
set the bounds of the first window to {mw + gap, mh + gap, mw + w + gap, mh + h + gap}
activate
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment