#!/bin/sh
#
# A small keyboard focus hack that uses qobi's workaround
#
# Provide the unique name of your window and get keyboard focus in it.
# GPL licenced. Share your code!

if [ "x$1" = "x" ] ; then
  gxmessage "Please specify a window name to focus."
  exit 1
fi

WINLIST=`debbie wmctrl -l`
FOCUSWIN=`echo "$WINLIST" | grep -i "$1" | awk '{print $1}'`

if [ "x$FOCUSWIN" = "x" ] ; then
  # gxmessage "No window found with the name $1"
  echo "No window found with the name $1"
  exit 2
fi

FOCUSCMD="set-focus $FOCUSWIN ; wmctrl -i -a $FOCUSWIN"
osso-xterm "debbie $FOCUSCMD"
