Setting Dynamic Window Title on Xterm and Custom Icon For Multiple Xterms At Launch

tl;dr:  This is how to set a dynamic title of the path name and variant icons in your xterm (and probably any other terminal application) without altering .Xresources.

It’s been a while since I wrote up a geeky howto.  You might remember (if you’re a *nix geek – and if you’re a Mac geek, you’re secretly a *nix geek, just saying) that I talked about using Xterm and making it behave nicely with copy and paste.  This worked out wonderfully – my terminal windows are nice and snappy.

Except.

They were all titled “xterm” and all had the same default non-icon.  Ick.  (And if you’re about to mention screen, know that I use it already for stuff like my IM and twitter client…)

So, after a pleasurable hour and a half of banging on a keyboard, I found out how to make Xterm not only title itself dynamically, but also how to make a number of icons automagically show up.

The title is actually pretty easy.  In your .bashrc, add these lines:

B’dow. Too easy.

Next, snag xseticon. If your distro has a copy, great – otherwise just compile it from source.

Then you’ll need to snag a nice clean terminal icon. The one from the One Bit icon set (free!) worked well for me:

Here’s what I did – I added a bunch of new transparent layers and put a “wash” of a different color on several variants using the GIMP. (That’s why I chose this image; the clean black area let me easily select it without any trouble.)

You’ll snag those icons and scripts from the github repository. Put the script wherever you like it, and make sure the paths in the script point to the actual icons.

Last step – alter your .bashrc, so that there’s an alias for xterm (see the README in the repository) that calls our script.

Then, whenever you call xterm, you’ll have a new colored icon and a title that reflects where the heck you were working.

This is one of those small annoyances that, once fixed, simply makes life so much easier. Huzzah!