Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!apple!rutgers!att!laidbak!laidbak!dye From: dye@laidbak.i88.isc.com (Ken R. Dye ) Newsgroups: comp.windows.x Subject: Re: Xterm ECS sequence Keywords: xterm Message-ID: <1989Sep14.183844.11835@i88.isc.com> Date: 14 Sep 89 18:38:44 GMT References: <5309@ucdavis.ucdavis.edu> <2617@husc6.harvard.edu> Sender: usenet@i88.isc.com (Usenet News) Reply-To: dye@i88.isc.com (Ken R. Dye ) Distribution: usa Organization: Interactive Systems Corporation, Naperville, IL Lines: 51 In article <2617@husc6.harvard.edu> kochhar@endor.UUCP (Sandeep Kochhar) writes: >In article <5309@ucdavis.ucdavis.edu> lee@iris.ucdavis.EDU (Peng Lee) writes: >> >>I notice certain ECS sequence can change the TITLE of xterm. I like to >>write a script or a alias to change title. Would one of the Xperts out >>there give me a hint? >> >>Thanx >> >>-Peng (lee@iris.ucdavis.ed) > >I use: > alias xname echo ']L\!*' > >Then > xname foo >changes the name of the xterm to foo... This also changes the icon name, which is ugly if you change it to something long. I use TWM, with titlebars, and a neat way to display your current directory in the title bar is: (ugly frag from .cshrc) if ($?prompt) then # interactive shell; set prompts and aliases set prompt="$USER@${HOST}: \!% " if ($term == sun) then alias cd 'chdir \!*;echo -n "^[]l ${HOST}:$cwd^[\"' else if (($term == vt100)||($term == xterms)||($term == xterm)) then alias cd 'chdir \!*;echo -n ^[]2 $HOST\:$cwd^M' else alias cd 'chdir \!*;set prompt=$HOST\:$cwd\:\ \\!%\ ' cd endif alias pu pushd \!\*\;cd . alias po popd\;cd . endif The ]2 {string}<^M> is what does the work (note the 2 instead of L in the above example; this just changes the title only. Note that the ^[ (two characters) is actually one, the ESC character, generated on the BSD line disipline by control-v followed by an ESC. Likewise, the ^M is input by control-v followed by control-m. The ^M could be any unprintable character, if you look at the ESC doc. These are BSD specific examples, and will have to be modified to run under a different shell or SYSV. The escape sequences should be good for any X11 xterm, however. -- Ken R. Dye an optimist is a guy Lachman Associates, Inc. Chicago that has never had (800) LAI-UNIX x341 much experience ..{sun|sequent|spl1}!laidbak!dye archy