Path: utzoo!attcan!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!purdue!decwrl!shlump.nac.dec.com!riscy.dec.com!fuel.dec.com!graham From: graham@fuel.dec.com (kris graham) Newsgroups: comp.windows.x Subject: Re: xterm titles Message-ID: <1519@riscy.dec.com> Date: 16 Nov 89 17:12:09 GMT References: <9897@fs2.NISC.SRI.COM> Sender: news@riscy.dec.com Lines: 64 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