#/bin/ksh
#
# ident "@(#)10browser.sh	1.2 01/05/29 SMI"
#
# Copyright (c) 2001 by Sun Microsystems, Inc.
# All rights reserved.
#

. /etc/opt/SUNWbb/blackbox.rc

ids=`cat $BBTMPPATH/$BBUSER.webtop | \
	grep '"Netscape: ' | awk '{print $1}'`

BBUPDNDIR=`bbfind_uuid_dir $BB_TOKEN`
TARGET=$BBUPDNDIR/webtop.browser

rm -f $TARGET

for id in $ids; do
        absX=`/usr/openwin/bin/xwininfo -id $id | \
                grep "Absolute upper-left X:" | \
                awk -F':' '{print $2}' | awk '{ print $1}'`
        absY=`/usr/openwin/bin/xwininfo -id $id | \
                grep "Absolute upper-left Y:" | \
                awk -F':' '{print $2}' | awk '{ print $1}'`
        Width=`/usr/openwin/bin/xwininfo -id $id | \
                grep "Width:" | \
                awk -F':' '{print $2}' | awk '{ print $1}'`
        Height=`/usr/openwin/bin/xwininfo -id $id | \
                grep "Height:" | \
                awk -F':' '{print $2}' | awk '{ print $1}'`
	geom="${Width}x${Height}+${absX}+${absY}"
        url=`/usr/openwin/bin/xprop -id $id | grep "_MOZILLA_URL" | \
                awk '{ print $3 }' | sed -e s/\"// | sed -e s/\"//`
        echo "$url $geom" >> $TARGET
done

exit 0

