summaryrefslogtreecommitdiffstats
path: root/abs/core/linhes-scripts/xwin_find.sh
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/linhes-scripts/xwin_find.sh')
-rw-r--r--abs/core/linhes-scripts/xwin_find.sh72
1 files changed, 0 insertions, 72 deletions
diff --git a/abs/core/linhes-scripts/xwin_find.sh b/abs/core/linhes-scripts/xwin_find.sh
deleted file mode 100644
index 35309dd..0000000
--- a/abs/core/linhes-scripts/xwin_find.sh
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/sh
-#
-# xwin_find [-v|-q] [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
-#
-# OPTIONS
-# -v verbose, print the full matching xwininfo line on stderr
-# -q do not print windows ID on stdout
-#
-####
-# Anthony Thyssen September 2005
-#
-PROGNAME=`type $0 | awk '{print $3}'` # search for executable on path
-PROGDIR=`dirname $PROGNAME` # extract directory of program
-PROGNAME=`basename $PROGNAME` # base name of program
-Usage() {
- echo >&2 "$PROGNAME:" "$@"
- sed >&2 -n '/^###/q; s/^#$/# /; 3s/^#/# Usage:/; 3,$s/^# //p;' \
- "$PROGDIR/$PROGNAME"
- exit 10;
-}
-
-timeout=0
-
-while [ $# -gt 0 ]; do
- case "$1" in
- [0-9]*) timeout=`date +%s`
- timeout=`expr $timeout + $1 + 1` || Usage
- ;;
- -q) QUIET=true ;; # don't print the final window ID, just status
- -v) VERBOSE=true ;; # output the full xwininfo line on stderr
-
- --) shift; break ;; # end of user options
- -*) Usage "Unknown option \"$1\"" ;;
- *) break ;; # end of user options
- esac
- shift # next option
-done
-
-[ $# -lt 1 ] && Usage "Missing window search regex"
-[ $# -gt 1 ] && Usage "Too many arguments."
-
-
-find_win() {
- # nice added to let it give way to starting processes
- if [ "$VERBOSE" ]; then
- line=`nice xwininfo -root -tree | awk '/"'"$1"'":/ {print; exit}'`
- echo >&2 $line # VERBOSE - xwininfo output
- echo "$line" | sed 's/ .*//'
- else
- nice xwininfo -root -tree | awk '/"'"$1"'":/ {print $1; exit}'
- fi
-}
-
-while :; do
- id=`find_win "$1"`
- if [ "$id" ]; then
- [ -z "$QUIET" ] && echo $id # the window ID found
- exit 0;
- fi
- [ `date +%s` -ge $timeout ] && break
-done
-
-exit 1 # window was not found
-