[comp.windows.x] xterm titles

cwilson@NISC.SRI.COM (Chan Wilson) (11/16/89)

I'm setting up default X startup files over here, and I'd like to have
the hostname appear on the title bar of the xterm windows.  Currently,
this is accomplished via a 'xterm -g 80x57+100-5 -title `hostname`' but I
would like to move this into the resource database, like so:

xterm*title	:`hostname`

However, when I try to, xrdb grabs the `hostname` as the title, as
opposed to expanding it. Browsing through the xrdb man page, I notice
that I can toss the file through a preprocessor.  Anything I can toss
it through to expand it?

................
Chan Wilson -- cwilson@nisc.sri.com <or> cwilson@nic.ddn.mil
'A computer operator at SRI International'  (X windows hacker)
"Nuts to all that X,Y,Z modem mess.  I'm gonna build me a FTP emulator."
................

-- 
--Chan Wilson
	     `and now for something completely different.'
	Flamingo coloured penguins and banana coloured grapes.
              cwilson@nisc.sri.com or cwilson@nic.ddn.mil

graham@fuel.dec.com (kris graham) (11/17/89)

n article <9897@fs2.NISC.SRI.COM>, cwilson@NISC.SRI.COM (Chan Wilson) writes:

> I'm setting up default X startup files over here, and I'd like to have
> the hostname appear on the title bar of the xterm windows.  Currently,
> this is accomplished via a 'xterm -g 80x57+100-5 -title `hostname`' but I
> would like to move this into the resource database, like so:
> 
> xterm*title	:`hostname`

> 
> However, when I try to, xrdb grabs the `hostname` as the title, as
> opposed to expanding it. Browsing through the xrdb man page, I notice
> that I can toss the file through a preprocessor.  Anything I can toss
> it through to expand it?

If you are interested in solving this problem via the  C shell (.cshrc file),
then here is a sample script.  It will even show the current directory in
the xterm title bar. 
-------------
#
if (! $?0) then
  # we've been run from a login session
  echo running .cshrc
  # my favorite aliases here
  #
  #
  if ($?TERM) then
    if ($TERM == xterm) then
     # stty dec  or something equivalent
     #
      echo "initializing xterm"
      #
      # save our hostname
      #
      setenv HOSTNAME `hostname`
      #
      # update the title right now
      #
      echo -n "]0;"${HOSTNAME}"::"${cwd}""
      #
      # alias to set the title freely
      #
      alias title 'echo -n "]0;"\!*"" '
      #
      # alias cd, pushd, popd to update the title bar with dir and host
      #
      alias cd 'cd \!*; echo -n "]0;"${HOSTNAME}"::"${cwd}"" '
      alias pushd 'pushd \!*; echo -n "]0;"${HOSTNAME}"::"${cwd}"" '
      alias popd 'popd \!*; echo -n "]0;"${HOSTNAME}"::"${cwd}"" '
      alias rlogin 'echo -n "]0;"\!*"::";/usr/ucb/rlogin \!*; echo -n
"]0;"${HOSTNAME}"::"${cwd}"" '
    endif
  endif
endif
#
-------------------------------

Don't forget to use the .XStartupfile for other relevant  resource management.

Christopher Graham          
Digital Equipment Corp            
Ultrix Resource Center                               
New York City

Erich_Belgarion_Proudfit@cup.portal.com (03/26/91)

I am using a system that has xdm run from the rc scripts...when I log in on 
my terminal, how can I set the environment to put up a title with the 
window that I start.  This is automatic with xstart & mwm, but not with
xdm & uwm.  Any ideas?
 
Erich Proudfit

gildea@expo.lcs.mit.EDU (Stephen Gildea) (03/29/91)

    I am using a system that has xdm run from the rc scripts...when I
    log in on my terminal, how can I set the environment to put up a
    title with the window that I start.  This is automatic with xstart
    & mwm, but not with xdm & uwm.  Any ideas?
     
The titles you see on your windows are generated by the window
manager, in your case mwm.  uwm does not put titles on client
windows.  xstart and xdm have nothing to do with it.  So use the
window manager that gives you the look you want.

 < Stephen
   MIT X Consortium