The READIN Family Album
Me and Sylvia (April 4, 2002)

READIN

Jeremy's journal

Los verdaderos poemas son incendios. La poesí­a se propaga por todas partes, iluminando sus consumaciones con estremecimientos de placer o de agoní.

Vicente Huidobro


(This is a page from my archives)
Front page
More recent posts
Older posts

Archives index
Subscribe to RSS

This page renders best in Firefox (or Safari, or Chrome)

🦋 Titles for xterms

Here's something handy: I keep a lot of xterm windows active on my desktop; if I lose track of one it's nice to have an easier way of finding it than to click on every "xterm" icon in my taskbar until I find it. So I give them titles.

The first thing I did was to give each a title with the machine name and the current directory. You can do this by adding to your .bash_profile the following:

PS1='\[\033]0;'`hostname`': \w\007\033[32m\]{\u@\h}\033[0m\] $ '

or to your .cshrc,

set prompt="%{\033]0;%m: %~\007%}%{\033[32;40m%}{%n@`hostname`}%{\033[37;40m%} > "

This just tells your shell to echo escape characters every time it draws the prompt that will force xterm to update its title bar.

Some applications -- generally every application that takes over the prompt, like for instance gdb -- I would like to know they're running just by looking at the title bar. For vi, all you have to do is use vim and include the line "set title" in your .vimrc. For other applications, I created a script called xtitle, which echoes the escape characters:

#!/bin/bash
echo -e "%{\033]0;"`hostname`": $*\007%}"

and alias the application names, like

alias gdb 'xtitle gdb \!*; \gdb'

(this is a csh alias, it's trickier in bash because I don't know how to echo the parameter list with bash aliases.)

posted evening of Friday, March 16th, 2007

Respond:

Name:
E-mail:
(will not be displayed)
Link:
Remember info

Drop me a line! or, sign my Guestbook.
    •
Check out Ellen's writing at Patch.com.

Where to go from here...

Friends and Family
Programming
Texts
Music
Woodworking
Comix
Blogs
South Orange
readinsinglepost