Big windows in TextMate

I’ve never been a big fan of the “distraction-free” full-screen writing programs. While I’m sympathetic to the idea of focusing on the work in front of you, much of my writing is done while referencing photographs, drawings, charts, web pages, and other materials on my computer. Having the text editor take up the whole screen forces me to switch back and forth between applications more often than I otherwise would, making it more difficult to focus, not less. Maybe if I were a novelist, working more from my head than from reference material, I’d think differently.

I do, however, like the idea of having my text editor window take up a big chunk of the screen, whether I’m writing or programming. To that end, I’ve written a very short AppleScript that resizes and repositions the frontmost TextMate window to take up most of the right half of my 24″ iMac’s screen.

tell application "TextMate" to set bounds of front window to [940, 120, 1860, 1100]
open location "x-launchbar:hide"

The script is called “Big Window.scpt” and it’s kept in ~/Library/Scripts/Applications/TextMate. I’ve trained LaunchBar to run it when I type “bw,” and it appears near the top of the FastScripts menu when TextMate is active, so I have two quick ways to get the window where I want it.

The first line does the real work. The list of numbers at the end of the line gives the left, top, right, and bottom coordinates that define the window’s rectangle. The top of the window is low enough to see the tabs in a Safari window behind it, which allows me to use these URL-getting scripts without switching applications. The bottom of the window is high enough to see a few files in the lower right corner of the Desktop, which is where I tend to put things temporarily. The right side of the window is up against the Dock, and the entire left half of the screen is available for whatever reference material I need as I write.

The second line of the script is LaunchBar-specific. It makes LaunchBar go away if that’s how the script was run; it does nothing if the script was called through FastScripts. I’m not sure this line is necessary if you’re running LaunchBar 5, but it is if, like me, you’re still using LaunchBar 4.

Obviously, I could reposition my TextMate window by mousing around, and that is, in fact, what I did back before I wrote this script. But now it takes just one quick command to get the screen the way I want it.

Tags: