Which environment variable?

Don Read dread at aceweb.com
Mon Jan 14 02:29:19 PST 2008


On Mon, 14 Jan 2008 09:35:41 +0200 Matiss said:

> Is there such environment variable, which changes window title for
> putty? I mean, MC is able to change it to working dir I think.. How
> do I change that title to let's say server name for my shell?
> 
> Thanks :)

man xprop

Or for the terminally lazy,
cat xtitle
#!/bin/sh
#
# gets/sets xterm title
#

me=`basename $0`
usage="Usage : $me [pwd | new title ... ] ('pwd' sets it to the current directory)";

Adjective='Current'

while [ $# -gt 0 ]
do
    case "$1" in
        --help | -help | -h | -\?)
            echo;
            echo $usage;
            exit 0;;
        -*) echo "$me: Unrecognized switch: $1 ($me -help to show valid options)";
            exit 1;;
        pwd) Adjective='New';
            Title=`pwd`;;
        *)  Adjective='New';
            Title=$1;
            while [ $# -gt 1 ]
            do
                shift;Title="$Title $1";
            done;;
    esac
    shift
done
if [ -n "$Title" ]
then
    xprop -id $WINDOWID -set WM_NAME "$Title";
fi
Title=`xprop -id $WINDOWID | grep WM_NAME | cut -d= -f2`
echo $Adjective 'title :' $Title
exit 0



-- 
Don Read                                      dread at aceweb.com
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.


More information about the freebsd-questions mailing list