Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Jan 2008 10:02:35 +0000
From:      Don Read <dread@aceweb.com>
To:        Matiss <move@inbox.lv>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Which environment variable?
Message-ID:  <20080114100235.1be0efa3@aceweb.com>
In-Reply-To: <1200296141.478b10cd53c0f@www.inbox.lv>
References:  <1200296141.478b10cd53c0f@www.inbox.lv>

next in thread | previous in thread | raw e-mail | index | archive | help
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@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.



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