Tim Retout's www presence

Thu, 23 Aug 2007

Automagic screen window titles

Lurking in #screen on freenode is paying off. I found out today that you can set your GNU Screen window titles automatically - so, while you are running a command, the title changes to that command. This will help when changing windows (such as when using the window list bound to C-a " by default).

This requires two things: first, your shell has to send an escape code as part of the prompt. With bash, there's a convenient spot in the default Debian .bashrc where $PROMPT_COMMAND is set depending on $TERM. Add a new case for 'screen', with:

PROMPT_COMMAND='echo -ne "\033k\033\134"'

The second part is to add a line to .screenrc:

shelltitle "$ |bash"

Where 'bash' is the default window title. This assumes that your prompt ends in "$ ".

See the GNU Screen Users' Manual for all the details. This also works well with a hardstatus line.

Posted: 23 Aug 2007 00:00 | Tags: , ,


Tim Retout tim@retout.co.uk
JabberID: tim@retout.co.uk


I'm afraid I have turned off comments for this blog, because of all the spam. Let's face it, I didn't read them anyway. Feel free to email me.

Me Elsewhere

Copyright © 2007-2014 Tim Retout