On-demand Quake-like console with iTerm and Alfred

This is fun: using Alfred to show or hide a Quake-like iTerm console, even if iTerm isn’t running.

iTerm

Ever since using Tilda on GNOME, I’ve loved having a terminal within easy reach, preferably a key-combo away ala the original Quake console. Once I started using a Mac, I missed it greatly — but after a little messing around it’s back!

First, you need iTerm, a full-featured (and free!) Terminal replacement. Set this up the way you like and save it as the default profile AND default window arrangement:

hotkey-profile

I prefer “Style: Top of Screen” and some transparency, and I also set iTerm to quit on close on the General tab, because I’m going to use Alfred to do both the initial launch and the show/hide toggle:

Screen Shot 2014-12-11 at 12.30.35 pm

Once it looks the way you want, save the window arrangement and set it as default:

Screen Shot 2014-12-11 at 12.36.48 pm

Alfred

Cool, so now you should have everything setup so that, when launched, iTerm looks the way you want it to. Launch and quit a few times to make sure, then add a simple Alfred workflow:

Screen Shot 2014-12-10 at 9.48.49 pm

If you’re not familiar with Alfred, you can use the little “plus” icon at the bottom left-hand pane on the Workflows tab to see examples and templates. I created the above with “Templates > Files and Apps > Launch file group from hotkey”.

⌘⌥` (cmd-alt-tilda, see?) seems a good one-hander, and close enough to force-quit (⌘⌥ESC) to seem native, but the real trick is in the iTerm action — “Toggle visibility for apps”:

Screen Shot 2014-12-11 at 12.56.38 pm

At the end of all this, and with no Applescript in sight, it means a single key combination for bringing up a Quake-like iTerm console that works no matter what:

  • … if iTerm isn’t running, Alfred launches it
  • … if iTerm is running but hidden, Alfred shows it
  • … if iTerm is running but behind another window, Alfred brings it to the foreground