lee@iris.ucdavis.EDU (Peng Lee) (09/14/89)
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)
kochhar@endor.harvard.edu (Sandeep Kochhar) (09/14/89)
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... Sandeep Kochhar (617) 495-3988 mail: kochhar@harvard.harvard.edu Harvard University kochhar@harvard.csnet 33 Oxford st, kochhar@harvard.uucp Cambridge, Ma 02138 kochhar@harvard.bitnet
dye@laidbak.i88.isc.com (Ken R. Dye ) (09/15/89)
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 <ESC>]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