Window management for Developers in Mac OS X

If you are spending 8+ hours a day on a computer, you will invariably wonder how you can optimize those for productivity. While you might have installed a few good productivity tools, one of the biggest productivity killer is a psychomotor context switch.

The most common psychomotor context switch is moving your hand(s) between your keyboard and mouse. Even if you are using a laptop with a large trackpad, mentally you still have to switch from using more than a hundred keys to using 3 keys but able to precisely move the pointer. Think about how many times you do that everyday. For developers, that happens a lot more than they can like.

To improve this situation, I use a window management tool: Slate. Slate lets you define how you want to layout your windows and assign keyboard bindings for common operations that you perform. While it may look intimidating at start because it does not have a GUI, starting small helps.

Slate requires a .slate file to be existing in your home (~/) directory. You can make a simple configuration for or a JS based configuration file. Slate has a good wiki page to detail both ways. I based mine on a blog post.

At work, I use a 3 monitor layout. I sometimes move to conference rooms where I switch to 2 monitor layout and finally when I am home or in a cafe, I am in 1 monitor layout. It can be quiet painful to (every time) rearrange half a dozen application windows exactly where you like them for the current monitor layout in their exact sizes. By using Slate I don’t even have to think about it. I can make it detect automatically when new screen is attached and how to rearrange my software so that they are at their appropriate place. Zero context switch.

For instance, here is how I define the 3 monitor layout:

# 3 monitor layouts
layout 3monitor 'Calendar':REPEAT ${full} 0
layout 3monitor 'Spotify':REPEAT ${full} 0
layout 3monitor 'Finder':REPEAT ${topleft} 1
layout 3monitor 'Wunderlist':REPEAT ${topright} 1
layout 3monitor 'Google Chrome':REPEAT ${full} 1
layout 3monitor 'Textual IRC Client':REPEAT ${full} 1
layout 3monitor 'Messages':REPEAT ${topleft} 1
layout 3monitor 'Sublime Text 2':REPEAT ${full} 1
layout 3monitor 'Xcode':REPEAT ${full} 1
layout 3monitor 'Instruments':REPEAT ${full} 1
layout 3monitor 'iTerm':REPEAT ${topright} 2
layout 3monitor 'Simulator':REPEAT ${topright} 2

Here,  I am telling slate to throw Calendar and Spotify on Screen 0 (the laptop’s smaller screen). I don’t see them often but like them around just when I need to. Then Finder, Wunderlist, Chrome, Textual, Messages, Sublime, Xcode and Instruments stay on screen 1. iTerm and Simulator are on screen 2. I have also defined size variables like $(full) and $(topleft) so that the windows are moved in the apropriate place too.

Another neat ability that slate provides is to bind applications to specific keys

bind r:cmd;alt focus 'Calendar'
bind x:cmd;alt focus 'Xcode'
bind w:cmd;alt focus 'Wunderlist'
bind f:cmd;alt focus 'Finder'
bind g:cmd;alt focus 'Google Chrome'
bind t:cmd;alt focus 'iTerm'
bind s:cmd;alt focus 'Sublime Text 2'
bind u:cmd;alt focus 'Textual IRC Client'
bind p:cmd;alt focus 'Spotify'

So I don’t have to use a mouse to activate a screen and I can even bypass Cmd+Tab as well. To switch to Spotify from anywhere, I only need to press cmd+alt+p.

You can find my slate dotfile here.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s