[nylug-talk] change title of xterm window

Dan Crosta
Wed Aug 23 08:28:24 EDT 2006


On Aug 23, 2006, at 2:33 AM, Luke Vanderfluit wrote:
> Is there any other way anyone knows of that I could make each  
> window distinguishable preferably with a meaningful title?

Certain control characters can be used to set the terminal title (for  
certain terms, at least -- this works in xterm, gnome-terminal,  
aterm, OS X Terminal at least):


---- termtitle.py ----
#!/usr/bin/env python
import sys

if len(sys.argv) > 1:
     print "\033]0;%s\007\r" % sys.argv[1],
else:
     print "\033]0;Terminal\007\r",
----

I also use the bash PROMPT_COMMAND to invoke this command to change  
it when i change directories -- not sure how you might go about  
changing it to, say, a program name when you execute something.  
Probably possible, though.

- d


More information about the nylug-talk mailing list