Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!carroll From: carroll@m.cs.uiuc.edu Newsgroups: comp.windows.x Subject: Re: changing titlebar strings; Frequent Message-ID: <26900101@m.cs.uiuc.edu> Date: 22 Feb 90 01:39:46 GMT References: <144945@<1990Feb14> Lines: 73 Nf-ID: #R:<1990Feb14:144945:m.cs.uiuc.edu:26900101:000:2311 Nf-From: m.cs.uiuc.edu!carroll Feb 21 16:13:00 1990 Here's my entry for the changing Xterm titles. Features of this system: + It's not in your prompt, so there's no annoying flicker when you're not changing directories. + It uses relative path names, so when you're in your home directory area, the path name is shorter (for some of us, _much_ shorter). + You can put leading headings in the title (and it would be trivial to add trailing ones). + You can inhibit the title changes. + You can put the PRWD variable in your prompt if you want, and get the relative path name there. - It requires Korn Shell. You can put a leading title (such as "Console: " for your console xterm) by using (e.g., in your .xinitrc) XTITLE='Console: ' xterm ... You can inhibit the change by using NOXTITLE=true xterm ... Put this in your .profile: HOST=$(hostname) ; HOST=${HOST%%.*} ; export HOST export PRWD="~" export XTITLE="" and this in your ENV file: # ] 0 ; string and string will become the title and icon name # ] 1 ; string for icon name only # ] 2 ; string for title name only XPRE="]0;" # There's a raw escape in here XPOST="" # and a raw control-G here function CD { \cd $@ PRWD=${PWD##${HOME}} if [ ! "${PRWD}" = "${PWD}" ] ; then PRWD="~$PRWD" fi if [ "$TERM" = "xterm" -a -z "$NOXTITLE" ] ; then print -n -r "${XPRE}${XTITLE}${PRWD}@${HOST}${XPOST}" fi } alias cd=CD CD . # force update at the start # have to fix rlogin and telnet so that they reset the title afterwards # set the functions indirectly with eval so that we can grab the current # whence value, and set it permanently. # in case we've already done this, we need to blow off any previous definitions unset -f telnet unset -f rlogin fred="function telnet { $(whence telnet) \$@ ; cd . ; }" eval "$fred" fred="function rlogin { $(whence rlogin) \$@ ; cd . ; }" eval "$fred" unset fred # Alan M. Carroll "I hold the line - The line of strength carroll@cs.uiuc.edu that pulls me through the fear. Conversation Builder: San Jacinto - I hold the line + Tomorrow's Tools Today + San Jacinto - Poison bite and Epoch Development Team Darkness take my sight -I hold the line." CS Grad / U of Ill @ Urbana ...{ucbvax,pur-ee,convex}!cs.uiuc.edu!carroll