November 07, 2013

A simple Slate configuration

I use Slate to manage my windows and I can’t imagine life without it. There are tools out there that are easier to set up than Slate (Divvy, SizeUp, etc) but I tried them all and found them lacking somehow. Slate can be a beast to configure simply because it is so incredibly customisable. The post that got me up and running was this one by Tristan Hume; it gave me the shove I needed to install and use Slate.

The hyper key

Central to my Slate (and Vim) usage is a re-mapped Caps Lock key to the so-called Hyper key. (More here.) I use Brett Terpstra’s variation so that I have ESC for a short press of Caps Lock (for use in Vim) and a combined Control Shift Option Command for a long one. Yes, that’s right, a whole new universe of keyboard shortcut possibilities.

Slate

Slate is configured from a .slate file and it really does have a bewildering array of options; you can go nuts with Slate config if you like, but I’ve kept it very simple. Everything is based around hyper f for full screen and then, using the layout of the keys around the F key as a guide, progresses clockwise starting with hyper t to move a window to Top Right (one quarter of the screen), hyper g for half a window on the right, hyper v for Bottom Right, hyper d for Left Half and hyper r for Top Left. It makes sense if you look at your keyboard: all the options are around the F key in roughly the same sequence as the window layout.

The only other option that I have currently configured is one which controls which window is in focus, so I can move around windows and, consequently, apps with two keystrokes. I’ve used vi-style bindings for this so hyper h will focus on the window on the left, hyper l the window on the right and hyper j and hyper k switch focus up and down. So I can have, say, an app open on half the window to the left and one each on the top left and right and hop around between them super-easy-style! Here’s my .slate file…

# http://larryhynes.net/2013/11/simple-slate-configuration.html
# Mostly taken from http://thume.ca/howto/2012/11/19/using-slate/

config defaultToCurrentScreen true
config resizePercentOf screenSize

alias lefthalf move screenOriginX;screenOriginY screenSizeX/2;screenSizeY
alias righthalf move screenOriginX+screenSizeX/2;screenOriginY screenSizeX/2;screenSizeY
alias topleft corner top-left resize:screenSizeX/2;screenSizeY/2
alias topright corner top-right resize:screenSizeX/2;screenSizeY/2
alias bottomleft corner bottom-left resize:screenSizeX/2;screenSizeY/2
alias bottomright corner bottom-right resize:screenSizeX/2;screenSizeY/2

alias hyper ctrl;shift;alt;cmd

bind l:${hyper}    focus right
bind h:${hyper}     focus left
bind k:${hyper}       focus up
bind j:${hyper}     focus down

bind r:${hyper} ${topleft}
bind t:${hyper} ${topright}
bind d:${hyper} ${lefthalf}
bind g:${hyper} ${righthalf}
bind f:${hyper} ${full}
bind c:${hyper} ${bottomleft}
bind v:${hyper} ${bottomright}

Update 12.03.15 I’ve switched to Hammerspoon for window management, with a similar setup. You can read more here.