One thing I liked in Gnome (maybe just Compiz?) was the option how the terminal windows tiled as you spawned new ones. However, I no longer use Linux on any of my workstations. At home I use a MacBook, iTerm being my terminal emulator of choice. Much to my dismay, iTerm spawns at each corner of the screen by default, like so:

Some people prefer this; I don't. I wanted my terms to spawn along the center of the screen. I looked through the preferences and found no easy solution. Then the power user in me spoke up. I can solve this with AppleScript! ...kind of!
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
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 |
So I ended up with this. I have it in a .scpt file that I can easily call with Quicksilver and load up four terms, just like this:

No comments:
Post a Comment