Newsgroups: comp.windows.x
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!nynexst.com!vermont!smehta
From: smehta@kwela.nynexst.Com (Sandeep Mehta)
Subject: Re: (how to) place cwd in title bar
In-Reply-To: chuck@Morgan.COM's message of 6 May 91 16:44:17 GMT
Message-ID: <SMEHTA.91May8172900@kwela.nynexst.Com>
Sender: news@nynexst.com (For News purposes)
Organization: Speech Technology, AI Lab, NYNEX S&T, White Plains, NY
References: <1991May2.195905.5199@garfield.cs.mun.ca> <3213@s5.Morgan.COM>
Date: 8 May 91 17:29:00


> chuck@Morgan.COM (Chuck Ocheret) writes:

>   The problem with modifying cd to set your title bar to show pwd is that
>   you may return from a subshell (or rlogin, rsh, etc...) where you did
>   a cd and now your title bar is incorrect.  If you can modify your

In addition to Chuck's ksh solution, here's what I do. I use a
combination of aliasing rsh (the command that causes me trouble most of
the time) and also using the .bash_logout (or .logout) file to reset
icon and/or frame titles...

So, in bash, I use this in my .bashrc if I'm not on console:

# main prompt is just hostname
 PS1='\h > '
# executed each time
 PROMPT_COMMAND="header \<\`date '+%H:%M'\`\> $HOST:\`dirs\`"
# alias rsh, save current hostname
 csh_alias rsh 'hostname > ~/.lasthost;iheader $*;/usr/ucb/rsh $*'

where iheader is:

function iheader() {
# ^[ is literal escape
	/bin/echo -n "^[]L$*^[\\"
}

and using the following .bash_logout:

# only if interactive
declare INT=$PS1
if [ "$INT" ]; then
    if [ "$TERM" = "sun" ]; then
        if [ ! $(/bin/tty) = "/dev/console" ]; then
            iheader "$(cat ~/.lasthost)"
        fi
    fi
fi
builtin echo -e \\014

you can modify the above for different term types...

on a Sun-3 this is slow, but not on a SPARC 2 :-)

hope this helps.

sandeep
--
smehta@nynexst.com
--

"But jazz is decadent bourgeois music," I was told, for that is what the
Soviet press had hammered into Russian heads.
"It's my music," I said, "and I wouldn't give up jazz for a world revolution"
	- Langston Hughes
