Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!mit-eddie!bloom-beacon!dont-send-mail-to-path-lines From: scott@statsci.UUCP (Scott Blachowicz) Newsgroups: comp.windows.x Subject: Re: Re: escape sequence to change title? Message-ID: <9105212004.AA18363@statsci.com> Date: 21 May 91 20:04:35 GMT Sender: daemon@athena.mit.edu (Mr Background) Reply-To: statsci!scott@uunet.uu.net Organization: The Internet Lines: 72 Regarding Re: escape sequence to change title? ; Stuart Marks writes: > You can indeed use escape sequences to change the title string for cmdtool > and shelltool. The escape sequences do differ, though, so you'll have to > put some smarts into your shell customization file to make this work if > you intend to switch between xterm and cmdtool. Here are the ksh-isms > that I use: > case $TERM in > sun*) > # Escape sequences for shelltool/cmdtool: > # \e]l...\e\ sets window title > # \e]L...\e\ sets icon label > titleprefix="$(print -n '\033]l')" > titlesuffix="$(print -n '\033\')" > iconprefix="$(print -n '\033]L')" > iconsuffix="$(print -n '\033\')" > ;; > xterm*) > # Escape sequences for xterm: > # \e]0;...^G sets both icon and window > # \e]1;...^G sets icon label > # \e]2;...^G sets window title > titleprefix="$(print -n '\033]2;')" > titlesuffix="$(print -n '\007')" > iconprefix="$(print -n '\033]1;')" > iconsuffix="$(print -n '\007')" > ;; > ... .or in csh and in case you use hpterm...(you can extrapolate the icons from the above...hpterm's icon_pre would be '^[&f-1k${icon_len}D', and you add a 'set icon_len ...' to the aliases). if ($?DISPLAY) then switch ($TERM) case xterm*: set title_pre = '^[]2;' set title_post = '^G' breaksw case *hpterm*: set title_pre = '^[&f0k${title_len}D' set title_post = '' breaksw case sun*: set title_pre = '^[]l' set title_post = '^[\' breaksw endsw endif if ($?title_pre && $?title_post) then alias cd 'chdir \!* ; set title_len=`expr length "${host}/${LOGNAME} : $cwd"`; set prompt = "${title_pre}${host}/${LOGNAME} : ${cwd}${title_post}$logstr.$host.$cwd:t> "' alias push 'pushd \!* ; set title_len=`expr length "${host}/${LOGNAME} : $cwd"`; set prompt = "${title_pre}${host}/${LOGNAME} : ${cwd}${title_post}$logstr.$host.$cwd:t> "' alias pop 'popd \!* ; set title_len=`expr length "${host}/${LOGNAME} : $cwd"`; set prompt = "${title_pre}${host}/${LOGNAME} : ${cwd}${title_post}$logstr.$host.$cwd:t> "' set title_len=`expr length "${host}/${LOGNAME} : $cwd"` set prompt = "${title_pre}${host}/${LOGNAME} : ${cwd}${title_post}$logstr.$host.$cwd:t> " else set prompt = "$logstr.$host.$cwd:t> " alias cd 'chdir \!* ; set prompt = "$logstr.$host.$cwd:t> "' alias push 'pushd \!* ; set prompt = "$logstr.$host.$cwd:t> "' alias pop 'popd \!* ; set prompt = "$logstr.$host.$cwd:t> "' endif Enjoy! Scott Blachowicz USPS: Statistical Sciences, Inc Voice: 206/283-8802 1700 Westlake Ave N, #500 Seattle, WA USA 98109 E-mail: scott@statsci.com .or.. uunet!statsci!scott .or.. scott%statsci.uucp@coco.ms.washington.edu