Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Jun 1997 09:45:31 -0700
From:      Scott Blachowicz <scott@apple.statsci.com>
To:        Eivind Eklund <perhaps@yes.no>
Cc:        Branson Matheson <branson.matheson@ferginc.com>, chat@FreeBSD.ORG
Subject:   Re: OS/2 users going to FreeBSD? :-) 
Message-ID:  <m0wekKy-0006uMC@apple.statsci.com>
In-Reply-To: Your message of "Thu, 19 Jun 1997 17:25:56 %2B0200." <199706191525.RAA15226@bitbox.follo.net> 
References:  <199706191239.IAA14178@gatekeeper.itribe.net> <Pine.NEB.3.96.970619091753.21140F-100000@toth.hq.ferg.com>  <199706191525.RAA15226@bitbox.follo.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
Eivind Eklund <perhaps@yes.no> wrote:

>         chpwd() { echo -n "\e]2; ${LOGNAME}@${HOST%%.*}:$(print -P %~) \007" } 

Cool...hadn't thought of the "$(print...)" sequence. Mine's amazing
similar except that it also does the same sort of thing for 'hpterm' and
Sun cmdtool/shelltool (yuk!) windows (but I haven't used them forever and
certainly haven't tested recent changes there) and for setting the icon
name to "user@host"...

set_title_vars () {
    [ "X$HOST" = X ] && export HOST=`hostname`
    [ "X$LOGNAME" = X ] &&
      export LOGNAME=`PATH=${PATH}:/usr/ucb:/bin whoami`
}
case "$TERM" in
    xterm*|X-hpterm*|sun*)
        settitle () { 
            set_title_vars
            if [ $# -eq 0 ] ; then
              str="${LOGNAME}@${HOST%%.*}:$(print -P %~)"
            else
              str="$*"
            fi
            WINDOW_TITLE="" export WINDOW_TITLE;
            case "$TERM" in 
              xterm) WINDOW_TITLE="\e]2;${str}\007" ;;
              X-hpterm)
                len=`expr length "$str"`;
                WINDOW_TITLE="\e&f0k${len}D$str"
              ;;
              sun*)
                if [ X"$WINDOW_PARENT" != X ] ; then
                  WINDOW_TITLE="\e]l${str}\e\\"
                fi
              ;;
              *) WINDOW_TITLE="" ;;
            esac;
            if [ "X$WINDOW_TITLE" != X ] ; then
                echo -n "$WINDOW_TITLE"
            fi
        }
        seticonname () { 
            set_title_vars
            if [ $# -eq 0 ] ; then
                str="${LOGNAME}@${HOST%%.*}"
            else
                str="$*"
            fi
            WINDOW_TITLE="" export WINDOW_TITLE;
            case "$TERM" in 
              xterm) WINDOW_TITLE="\e]1;${str}\007" ;;
              X-hpterm)
                len=`expr length "$str"`;
                WINDOW_TITLE="\e&f-1k${len}D$str"
              ;;
              sun*) # don't know how (or care how).
              ;;
              *) WINDOW_TITLE="" ;;
            esac
            if [ X"$WINDOW_TITLE" != X ] ; then
                echo -n "$WINDOW_TITLE"
            fi
        }
        settitle
        seticonname
    ;;
    *)
        settitle () {
            : no title bar
        }
        seticonname () {
            : no icon window
        }
    ;;
esac
--
Scott Blachowicz  Ph: 206/283-8802x240   Mathsoft (Data Analysis Products Div)
                                         1700 Westlake Ave N #500
scott@statsci.com                        Seattle, WA USA   98109
Scott.Blachowicz@seaslug.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m0wekKy-0006uMC>