Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!brutus.cs.uiuc.edu!apple!sun-barr!newstop!texsun!smunews!ti-csl!m2!bannon From: bannon@betelgeuse.csc.ti.com (Tom Bannon) Newsgroups: comp.windows.x Subject: Re: changing titles Message-ID: Date: 13 Feb 90 19:45:54 GMT References: Sender: news@ti-csl.csc.ti.com Distribution: comp.windows.x Organization: TI Computer Science Center, Dallas Lines: 48 In-reply-to: niermann@grumpy.csg.uiuc.edu's message of 11 Feb 90 20:37:21 GMT In article niermann@grumpy.csg.uiuc.edu (Tom Niermann) writes: > Is there a way to change the name displayed in the title bar from the command > line ? > This could be done in sunwindows and was useful for displaying the current > directory and machine logged into by aliasing rlogin and cd. I got this off the net awhile ago (comp.windows.x, from graham@fuel.dec.com (kris graham)) and modified it a bit to suit my tastes. By aliasing certain commands you can get your current working directory in your xterm title bars, which I find very nice. I have the lines below sitting in my .cshrc. The "^[ is really "ESC[ and the "^G" is "control-G". You can get the current directory string more than one way, see the pwd man page if you are interested. You will get funny results if the machine you are logging into does not have the hostname program, which I use to set the variable HOST; there may be better ways to get the host name than this. With the []2 these escape sequences only affect the title bar on the xterm window, specify []0 if you would like it to affect the icon name as well. BTW, this topic is beginning to look like a candidate for the "Common Questions & Answers" bin. Enjoy, Tom bannon@csc.ti.com Computer Science Center Texas Instruments, Dallas ---------- # Put machine and current directory in xterm title bar setenv HOST `hostname` if ($?DISPLAY) then echo -n "]2;"${HOST}":"`pwd`"" endif # Alias to set the title freely alias title 'echo -n "]2;"\!*"" ' # Alias cd, pushd, popd to update the title bar with dir and host alias cd 'cd \!*; echo -n "]2;"${HOST}":"`pwd`"" ' alias pushd 'pushd \!*; echo -n "]2;"${HOST}":"`pwd`"" ' alias popd 'popd \!*; echo -n "]2;"${HOST}":"`pwd`"" ' alias rlogin 'echo -n "]2;"\!*":";/usr/ucb/rlogin \!*; echo -n "]2;"${HOST}":"`pwd`"" '