[Lancaster] perl script to change your xterm title

Andy Baxter andy at earthsong.free-online.co.uk
Wed Jun 4 12:24:00 2003


Sometimes when I have a lot of terminal windows open in KDE, it gets 
confusing which is which, so I wrote a mini perl script to change the 
window/icon title on the fly using VT102 control characters. The code is as 
follows:

#!/usr/bin/perl
#
# termname - change icon and window name of this terminal.
#

print chr(27)."]0;$ARGV[0]".chr(7);


so if you stick this in /usr/local/bin as 'termname' then 

chmod 755 termname

you'll be able to type 

termname "frabjous day"

and the window and icon title will change to 'frabjous day'.
It works on all the xterm clones i have installed apart from cmdtool.
What set me off on this is I played an MP3 file into the terminal's STDOUT to 
see what would happen, then the window title changed to 
'0kw**(*&^8h1kjhs89hsdh)(*}{' or something, so i thought there must be a way 
to do it.
Do I get the 'sad linux geek' badge and t-shirt?

andy