How to change Xterm titles
Updated on Tue, 2009-02-17 13:28 by testadmin. Originally created by jeromel on 2009-02-17 12:59.
I should know this by heart but ...
Window and icon titles may be changed in a running xterm by using XTerm escape sequences. The following sequences are useful in this respect:
ESC]0;<b>string</b>BEL
-- Set icon name and window title to stringESC]1;<b>string</b>BEL
-- Set icon name to stringESC]2;<b>string</b>BEL
-- Set window title to string
where ESC
is the escape character (\033), and BEL
is the bell character (\007).
echo -n "\033]0;${USER}@${HOST}\007"
should produce a title like username@hostname
, assuming the shell variables $USER
and $HOST
are set correctly. The required options for echo
may vary by shell (see examples below).
The following short script should help setting the title to an arbitrary value:
#!/bin/csh if ( "$1" != "") then /bin/echo "Setting title to [$1]" /bin/echo -ne "\033]0;"$1"\007" /bin/echo -ne "\033]1;"$1"\007" endif
»
- jeromel's blog
- Login or register to post comments