xtset or xtermset tricks?

Duane Winner duanewinner at att.net
Tue Aug 17 10:10:51 PDT 2004


This is a little better:

cd ()
{
     # do the actual cd
     builtin cd "$@"

     # if in homedir, then make path '~', not full path
     if [ $PWD == $HOME ]; then
         XTDIR="~"
     else
         XTDIR="$PWD"
     fi

     # set xtset title and icon to user at host:path
     /usr/local/bin/xtset %u@%h:`echo $XTDIR`
}

# force an xtset title at shell login:
cd


-Duane



Duane Winner wrote:
> Found a solution!
> 
> In ~/.bashrc, put this:
> 
> cd ()
> {
>    builtin cd "$@"
>    /usr/local/bin/xtset %u@%h:`pwd`
> }
> 
> 
> 
> -Duane
> 
> 
> Duane Winner wrote:
> 
>> Hello,
>>
>> Hey, does anybody know of any useful tricks for automating xtset or 
>> xtermset?
>>
>> I use xtset to set the title and icon labels to user at host:path so I 
>> can keep track of my xterms littered all over my desktop (pretty 
>> frequent! :)
>>
>> But it sure would be nice to have them updated whenever I 'cd' to 
>> another directory or 'su' to another user or 'ssh' to another host!
>>
>> I'm sure there's got to be someway to make this a little more seamless 
>> then running # xtset %u@%h:`pwd` everytime, but I'm just not good 
>> enough with shell programming to know how to do this.
>>
>> The closest I came was writing a small bash script that does:
>>
>>    for filename in /dev/ttyp*; do
>>       /usr/local/bin/xtset %u@%h:`pwd` > "$filename"
>>    done
>>
>> And thought about cron'ing it (every minute), but the problem is that 
>> when I tested this, all my xterms get the same title/icon based on who 
>> is running the script and where at the time. No good :(
>> (And of course this would be useless to update the titles/icons for 
>> xterms that are remote shells (ssh).
>>
>>
>> Any thoughts?
>>
>> Thanks!
>> Duane
>> _______________________________________________
>> freebsd-questions at freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
>> To unsubscribe, send any mail to 
>> "freebsd-questions-unsubscribe at freebsd.org"
>>
> 


More information about the freebsd-questions mailing list