start and resize mac terminal windows
Posted on February 17, 2009
Filed Under mac, programming | 2 Comments
i work mostly on the command line and generally like to use two terminal windows splitting the screen as large as i can get them.
it can be somewhat tedious resizing and repositioning the windows all of the time so i figured out how to do it in applescript:
tell application "Terminal"
do script ""
tell front window
set position to {1441, 0}
set number of columns to 135
set number of rows to 76
end tell
do script ""
tell front window
set position to {2277, 0}
set number of columns to 135
set number of rows to 76
end tell
end tell
each of the do script “” lines above tell the terminal application to run an empty script, causing it to open an empty window. this new window becomes the front window which you can tell to resize and reposition itself.
i use a macbook pro with an external lcd positioned to the right. the width of the macbook’s lcd in pixels is 1440 and the external lcd’s display begins at pixel 1441. the script above opens one window in the upper left corner of the external lcd and another in the middle of the external lcd.
copy the script above into ScriptEditor and save it somewhere as a script.
you’ll probably need to iterate through a few cycles of running and tweaking the script to get the window placement as you’d like it.
you can open more windows by adding more sets of do script/tell front window lines.
when you are satisfied with your changes then save the script and then save it again as an application. i called mine “twoBig”.
you can find it from spotlight by typing in the name of the application. you might need to wait a few seconds the first time.
be sure to select the application version of the script and not the script version.
Comments
2 Responses to “start and resize mac terminal windows”
Leave a Reply
Very cool.
I ran into your profile on RAC. We are looking for a developer for a point of sale software package in the Austin area. If your interested send me an email and I can forward the details. I will be in the Austin area next week and we can possible meet to discuss the project.
Thanks.