gp with labels on top

I just discovered a neat trick that makes my gp script that little bit more useful to me. Although it could open all of the terminal tabs and commands I needed, all those tabs got labels like "Shell".. not very useful when you are trying to remember which one has the development log and which one the console.

But I noticed that, when I ssh'd to our Engine Yard slice (What's that? You don't use Engine Yard for your applications? Shame on you!) that its tab label changed to username@host. Not terribly useful given the truncation involved but, nevertheless, different. Hrmm...

A quick Google came up with instructions for changing the terminal window title which basically uses the echo command with some strange escape sequence, so that:

rake log:clear; echo -n -e "\033]0;Dev log\007"; clear; tail -f log/development.log

gives me a tab labelled "Dev log" which is a lot more useful than "Default" or "Shell".

I've amended the rails script I use to:

mate .; diffly .;  echo -n -e "\033]0;Mongrel\007"; clear; mongrel_rails start
rake log:clear; echo -n -e "\033]0;Dev log\007"; clear; tail -f log/development.log
echo -n -e "\033]0;Req log\007"; clear; tail -f log/request.log
open -a BonEcho http://localhost:3000/; echo -n -e "\033]0;Console\007"; clear; ruby script/console
echo -n -e "\033]0;IRB\007"; clear; irb
echo -n -e "\033]0;Spare\007"; clear

and, for such a small change, it's markedly more useful.

I might package the gp script up as a gem in case others might find it useful. Let me know if you do.

01/11/2007 16:33 by Matt Mower | Permalink | comments:
More about: