Archive for August, 2007

Keyboard Shortcut for “Zooming” Mac OS X Windows

Thursday, August 16th, 2007

For the longest time I’ve been pining for a way to have a keyboard shortcut “maximize”, or, in Mac parlance, “Zoom” the current window. Ideally, it would be a toggle.

Well, I found a way to do it today.

First, you’ll need either FastScripts or FastScripts Lite (available at the same link). Install it, and set it up to run at login.

Next, if you don’t already have it, create a new folder at ~/Library/Scripts. Open Script Editor (/Applications/Applescript/Script Editor), and type in this script:

tell application "System Events"
	set currentapp to item 1 of (get name of processes whose frontmost is true)
end tell

tell application currentapp
	tell front window
		if zoomable then
			if zoomed then
				set zoomed to false
			else
				set zoomed to true
			end if
		end if
	end tell
end tell

It’s also here at pastebin.com.

Save it as something like “Zoom Front Window”, as a script, in ~/Library/Scripts. Then, you can open your FastScript preferences, and assign the keyboard shortcut you like to it. I currently use Option-Shift-=, because it’s the same physical keys as what I used on my Linux boxes for the maximize window shortcut.

Have fun!