Sunday, August 26, 2007

OS X Finder iTerm applescript window tiling

If you are an OS X developer no doubt you use iTerm. If you haven't set up your unix environment to synchronize between Finder and OS X you should. There are a number of examples but here is the ones I used since I'm a zsh fan:

iTerm Terminal Customization

Now the other thing I wanted was to have a quick-key combination to display both the front finder and iTerm windows and position them nicely tiled. This way I could work in an IDE but have my bare-bones development windows appear in a snap. Here is my applescript code:


tell application "Finder"
--make new Finder window
activate
if not (exists window index 1) then
make new Finder window
end if
set {x1, y1, x2, y2} to bounds of window index 1
end tell

tell application "iTerm"
activate
if not (exists window index 1) then
set myterm to (make new terminal)
tell myterm
launch session "Default Session"
end tell
end if

set {xx1, yy1, xx2, yy2} to bounds of window index 1
set bounds of window index 1 to {x1, y2, x2, y2 + (yy2 - yy1)}
activate
end tell


Store the script in your home/Library/Scripts folder and from there you can assign a hot-key.

Why don't I just use PathFinder? Well I own it and used it quite a bit but there are things that just make me angry about it that hopefully they'll fix.


1. It is a resource hog
2. It doesn't allow me to simply type a path into an input box (actually almost all OS X Finder clones have this issue). OS X developers seem to like the mouse and drilling down.
3. The UI can be quite busy and some things that should be simple (finding files in the current directory or below for example are a pain in the butt.


Anyway, now that I'm doing quite a bit of development on my mac I'm using QuickSilver, Finder, and iTerm with applescript to glue them together. Simple.

What inspired me to dump PathFinder? This great podcast that showed how much hidden value is in the limited basic Finder application and how a little knowledge can make it much better suited to your workflow.

Living with the Finder

No comments: