From: markhof@ls12r.informatik.uni-dortmund.de (Ingolf Markhof)
Subject: Re: Title for XTerm
Organization: CS Department, Dortmund University, Germany
Lines: 55
Distribution: world
NNTP-Posting-Host: ls12r.informatik.uni-dortmund.de
Keywords: XTerm

In article <1quh74$r71@irz401.inf.tu-dresden.de>, beck@irzr17.inf.tu-dresden.de (Andre Beck) writes:
|> 
|> In article <C5oL74.3B1@aeon.in-berlin.de>, thomas@aeon.in-berlin.de (Thomas Wolfram) writes:
|> |> >Hey guys!
|> |> >I work on many stations and would like this name and current logname
|> |> >to be in a title of Xterm when it's open and a machine name only
|> |> >when it's closed. In other words, I want $HOST and $LOGNAME to appear
|> |> >as a title of opened XTerm and $HOST when XTerm is closed.
|> |> >How can I do it?
|> |> 
|> |> Almost all window managers (twm, mwm, olwm and their derivates) support
|> |> escape sequences for it. For your purpose put following into your
|> |> .login (if you're using csh or tcsh), for sh you have to modify it.
|> |> 
|> |> if ( "$term" == "xterm" ) then
|> |> 	echo "^[]2;${LOGNAME}@${HOST}^G^[]1;${HOST}^G"
|> |> endif
|> |> 
|> 
|> 1) This is NOT a feature of the Window Manager but of xterm.
|> 2) This sequences are NOT ANSI compatible, are they ?
|>    Does anyone know IF there are compatible sequences for this and what they
|>    are ? I would think they are DCS (device control sequence) introduced,
|>    but may be a CSI sequence exists, too ?
|>    This MUST work on a dxterm (VT and ANSI compatible), it may not work
|>    on xterms.

It works on xterms. At least I have no problem with it. - Back to the original
question:

I usually start new xterms by selecting the proper menu entry in my desktop
menu. Here is a sample command:

	xterm -sl 999 -n ls12i -title ls12i -e rlogin ls12i &

The -n and -title options give the text for window and icon. As I use the
tcsh (a wonderful extension of the csh), I can do the following:

I have an

	alias precmd echo -n '^[]2\;${HOST}:$cwd^G'

in my ~/.tcshrc. This is a special alias for tvtwm. It is executed each time
before printing the prompt. So, I have the current host name and the current
directory path in the title bar of my xterms.

------------------------------------------------------------------------------
      ____                                                                    
  UniDo  /  Ingolf Markhof  University of Dortmund, LS Informatik XII         
 ___/   /                   P.O. Box 500 500, D-4600 Dortmund 50, F.R. Germany
 \  \  /                    Phone: +49 (231) 755 6142, Fax: +49 (231) 755 6555  
  \__\/                     Email: markhof@ls12.informatik.uni-dortmund.de    
                                                                              
------------------------------------------------------------------------------

