To make the use of my computer screen space, I move windows to the edge of the screen. That way there's no wasted space between the edge of the window and the edge of the screen. In Windows, I use The Wonderful Icon for this. In Linux, I used the Sawfish window manager (but I see no way to do this in Metacity, the preferred GNOME window manager). In Mac OS X, I've been manually moving windows around. Today I found Spooky, a set of scripts that let you move and resize windows to the screen edge.

Spooky isn't user friendly. It's a set of scripts that you have to modify. Here's what I did:

  • Put Spooky into a folder.
  • Turn on “access” for universal devices (see the Spooky readme).
  • Edit the Spooky starter script to fix what appears to be a script error. I changed
    do shell script
      ("defaults write net.doernte.spooky 
            \"pathToSpooky\" " & spookyFile)


    do shell script
      ("defaults write net.doernte.spooky 
            pathToSpooky \"" & spookyFile & "\"")
  • Copy the Spooky starter script to one script for each action (see the Spooky readme):
    for action in maximize centerWindow growWindow 
                  shrinkWindow maxBottomLeft
                  maxBottomRight maxBottom maxLeft maxRight 
                  maxTopLeft maxTopRight
                  maxTop moveBottomLeft moveBottomRight 
                  moveBottom moveLeft moveRight
                  moveTopLeft moveTopRight moveTop zoomWindow; do
         cp spooky\ starter.scpt spooky.$action.scpt; 
  • I then had to edit each of these scripts in Script Editor, uncommenting out the line corresponding to the action for that script. In spooky.moveTop.scpt for example I uncommented out spooky("moveTop"). I would've liked to automate this using perl, but Applescripts are stored in some binary format (why?!).
  • Finally, I assigned hotkeys to run the scripts using Quicksilver's custom triggers. This was quite a pain, as Quicksilver didn't pick up these applications, so I had to drag each action manually into a custom trigger. I gave them the keybindings suggested in the Spooky readme.

Although setting things up was more of a pain than I'm used to, now that they're set up, I'm much happier. For my browser, which I want on the right side of the screen, I use Ctrl-Right, Ctrl-Shift-Down, Ctrl-Shift-Up to position and size it. For my work window (usually Emacs), the sequence is similar except I start with Ctrl-Left. I'm much happier having windows go to the edge of the screen; now I don't have to precisely position and size them with the mouse.

Update: [2014-07-03] I haven't used Spooky for quite a while. I now use BetterTouchTool and Alfred. But if you're looking for something programmable like Spooky, look at Hydra.

Update: [2016] Also take a look at BetterSnapTool, Sticker, Slate (for power users), Divvy, Moom, Spectacle. There are many more. I use Stay and Alfred these days.

Labels: ,


Anonymous wrote at Saturday, September 9, 2006 at 2:24:00 AM PDT

Hi Amit! I also had to fix this line to get Spooky working:

set spookyFile to (do shell script ("defaults read net.doernte.spooky \"pathToSpooky\" "))

You're right, it IS a big pain in the butt to setup, but it's a real joy once it's setup. Huzzah! :)

Amit wrote at Tuesday, October 17, 2006 at 10:09:00 PM PDT

Thanks Tim!

Unknown wrote at Tuesday, April 22, 2008 at 1:43:00 PM PDT

Do you know of anything that works for Leopard? In Windows, FreeSnap is priceless in how it can order windows neatly. Right now I'm slaving over trying to align everything exactly center, or perfectly in a corner, etc.

Amit wrote at Thursday, April 24, 2008 at 9:40:00 AM PDT

I've been using Spooky with Leopard. It sometimes fails but I think it's just flakiness with Spooky, not with Leopard.

Unknown wrote at Thursday, April 24, 2008 at 6:08:00 PM PDT

Thanks for the information, I will try it out now! I thought it didn't work because I recently e-mailed the author of the script, who provided me with a copy w/o Microsoft Office (if one doesn't have Office installed, the script is broken). Unfortunately, that didn't work, and I hadn't bought Office 2008 yet so I thought it was broken with Leopard. I just tested it out, and it works.

Thanks again!

Anonymous wrote at Saturday, July 5, 2008 at 4:48:00 PM PDT

So what this basically does is create a window manager for Leopard, which really doesn't have one? I'm tempted to try it, but probably my time will be better spent looking into replacing
OS X on my Macbook altogether.

For window managers in Linux I like IceWm and Awesome. (dumb name, but not hyperbole.) Gnome's behavior seems to mac-like to me, and I can't understand why neither Gnome nor KDE seem to support tiling of windows, which even MS lets you do.

Amit wrote at Saturday, July 5, 2008 at 11:20:00 PM PDT

Spooky doesn't create a window manager. The Mac has a window manager but doesn't expose a lot of keyboard shortcuts. It is, however, scriptable, like Sawfish on X, except it uses Applescript instead of a custom language. Spooky is a set of scripts to send commands to the window manager. In theory, tiling could also be done with scripts, just as with Sawfish. (Side note: I find Gnome's default window manager to be very primitive compared to Sawfish and other window managers that we had in the old days.)

Steve wrote at Friday, May 21, 2010 at 12:59:00 AM PDT

This article is a bit dated, but it's worth mentioning that window management has come a long way. Here are some good options:

Cinch - $7 - is like Aero Snap for Mac.

SizeUp - $13 - allows you to easily position window using keyboard shortcuts.

Breeze - $8 - allows you to save window states and restore them like a template to another window.

Divvy - $14 - shows a grid on the screen where you can select boxes to indicate how you want the window to fill your screen.

Amit wrote at Friday, May 21, 2010 at 1:34:00 PM PDT

Thanks Steve! I had seen SizeUp but not the others. I'm still using Spooky, with Spark instead of with Quicksilver, because it's working well enough for me.

Laurence wrote at Monday, September 27, 2010 at 11:58:00 AM PDT

I finally got around to setting this up. Setup is pretty painful, and the fact that Quicksilver is buggy (it kept "forgetting" my hotkeys) didn't help. I switched to Spark, and it seems to work reliably.

I looked at some of the other options that Steve mentioned, particularly SizeUp. I ended up going with Spooky because it looked like the other options aren't configurable enough, and don't support some of the window actions I'm used to. Also, the fact that two of my top-3 apps (MacVim and Terminal) are in SizeUp's list of "known 'trouble' applications" didn't exactly endear it to me.

Even Spooky didn't support most of the actions I wanted, but at least I can edit the source to add the actions I want. This wasn't too hard, despite the fact that I had no previous knowledge of AppleScript (which is a *horrible* language, BTW).

One of these days I might look into rewriting this in Python using AppscriptModule, but for now, it works.