Liam Curry

Random and incomplete ramblings and thoughts

Goodbye TotalTerminal. Hello Quicksilver and iTerm2

I spend the vast majority of my work day in the command line, and easily showing and hiding my terminal with TotalTerminal is a feature I could no longer do without.

There are several problems with TotalTerminal though. The biggest complaint I have with it is that you’re forced to use OSX’s built in Terminal.app, which is pretty inferior when compared to iTerm2. iTerm2 even comes with it’s own TotalTerminal-esque hotkey.

The iTerm2 hotkey works great most of the time, but it apparently just doesn’t work in fullscreen mode, which is important since I do most of my development on small screen and need the extra space. The answer to my problems is Quicksilver and a short AppleScript snippet.

If you’re not using Quicksilver already, you should. It’s a great way to quickly launch applications, find files, and more. In this case, we’ll be using it to run an AppleScript file when we press a hotkey.

1
2
3
4
5
6
7
8
9
10
11
tell application "System Events"

    set thisApp to name of first process whose frontmost is true

    if thisApp is "iTerm" then
        tell application "Google Chrome" to activate
    else
        tell application "iTerm" to activate
    end if

end tell

The code above will detect the currently selected application and switch to iTerm2 if it’s not already selected. When iTerm2 is selected, it will switch to Chrome instead. This is a good setup for me as a web developer, but you may want to modify this behavior. I initially tried to have it just send a Command+Tab (alt+tab for all you PC users) keystroke to go back to the previous application, but was having issues getting it to work properly.

To have this script run on a keystroke, copy and paste the code above and save it somewhere on your computer. Open up Quicksilver’s “Trigger” preferences and add a new custom trigger to run the script you just saved. I have Ctrl+; setup to toggle between iTerm2 and Chrome (I also have Ctrl remapped to capslock).

If everything is setup right, you should now be able to press your hotkey and toggle between iTerm2 and Chrome!

As an aside, this was my first time playing with AppleScript, and I’m quite impressed. There’s a lot you can do with such a nice, readable syntax. I’ll probably end up writing more scripts in the future to automate/hack more of my workflow.

Blogging Like a Hacker With Jekyll

Creating a blog is something I’ve been meaning to do for awhile, but between work and personal projects (and, I admit, Minecraft) I could never find the time. I looked into a lot of blogging systems, from hosted platforms like Tumblr or Posterous, to self-hosted solutions like Wordpress. My issue was that I wanted the best of both worlds: something super simple, that I had complete control over.

Enter Jekyll

Jekyll is a simple git-powered blogging engine built with Ruby. My favorite thing about Jekyll is that it generates sites that can be deployed literally anywhere. That’s because Jekyll ultimately just generates static HTML, CSS, and Javascript. In fact, most Jekyll-powered blogs are deployed using Github’s free pages service (like this one).

There are a couple projects to help users start using Jekyll with many of the features they’d get from other blogging platforms. Most notably are octopress and jekyll-bootstrap. I chose to go with Octopress because it seemed more complete and had more batteries included.

Quick start

1
2
3
4
5
6
7
8
git clone git://github.com/imathis/octopress.git octopress
cd octopress
bundle install           # assumes you have bundler installed. run gem install bundler otherwise
rake install             # install the default Octopress theme
rake setup_github_pages["git@github.com:YOURUSERNAME/YOURUSERNAME.github.com.git"]  # sets up branches and changes origins
rake new_post["Hello World!"]  # Creates a new post
rake generate            # generates static files
rake deploy              # deploys the site. check out YOURUSERNAME.github.com!

If you have trouble with the snippet above, or you’d like a more in-depth tutorial, take a look at the Octpress setup guide. If you have an existing blog that you’d like to migrate, you should also take a look at Jekyll’s migration guide.