[EMAIL PROTECTED] on wrote...
| - Re: gnome-panel and UsePPosition/RandomPlacement (help)
| | Thank you for xwit it was just the tool needed with CTWM
|
| I'm glad it worked for you! Handy tool that, eh?
|
XWit is great, but its '-name' search is not very useful, especially as
I found the gnome panels name varies from linux to linux.
For example you can set the panels name in Fedora and Redhat Enterprise,
but in Ubuntu Linux (basied on debian) you are not allowed to name or
rename the panels!
I re-worked my wait_for_xapp() shell function into a seperate shell
script (included below). This lets you specify a window using a
awk regular expresion, and allows you to specify a timeout for the
application to appear in seconds (plus or minus a couple of seconds).
Without a timeout it just finds the window you are looking for
EG:
xwit -iconify -id `xwin_find '.*Bookmarks.* - Mozilla'`
To iconify my mozilla window displaying bookmarks.
=======8<--------
#!/bin/sh
#
# xwin_find [timeout] window_name_regex
#
# Look for a window of the windows full name given by a awk regular
# expression, and print the windows xwindow ID.
#
# If a timeout is given (in seconds)continue to look for the windows ID
# for this amount of time before returning. (EG default a single search)
#
# If no such window is found output nothing, just exit
#
# This should probably be re-written in perl as "date +%s" is a GNU
# addition, as is "usleep", and NOT available on ALL unix systems...
#
find_win() {
xwininfo -root -tree | awk '/"'"$1"'":/ {print $1; exit}'
}
timeout=0
if [ "$#" -gt 2 -o "$#" -eq 0 -o "X$1" = 'X-?' ]; then
echo >&2 "Usage: xwin_find [timeout] window_name_regex"
exit 10
elif [ "$#" -eq 2 ]; then
timeout=`date +%s`
timeout=`expr $timeout + $1 + 1`
shift
fi
while :; do
id=`find_win "$1"`
if [ "$id" ]; then
echo $id
exit 0;
fi
[ `date +%s` -ge $timeout ] && break
usleep 100
done
exit 1 # window was not found
=======8<--------
My Gnome start up (with Gaim startup) with re-positioning of its Top
or Side Panel to +0+0 is now...
=======8<--------
# ----- Gnome Panel -----
( # Start the gnome panel launcher and related clients
gnome-panel &
gaim &
# Re-position a Gnome Side Panel
id=`xwin_find 10 "(Top|Side).* Panel"`
if [ ! "$id" ]; then
xmessage -center -buttons '' "ERROR: Gnome-Panel not found" &
exit 10 # failed! -- exit sub-shell
fi
usleep 50 # pause a moment for it to settle
xwit -move 0 0 -id $id
# Now start Gaim and unmap the buddies list (now docked)!
id=`xwin_find 10 "Buddy List"`
[ "$id" ] && xwit -unmap -id $id
) &
=======8<--------
Anthony Thyssen ( System Programmer ) <[EMAIL PROTECTED]>
-----------------------------------------------------------------------------
Okay, who stopped the payment on my reality check? -- A Bumper Sticker
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/