#!/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=`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="sudo debian qobi-wmhint-fix $FOCUSWIN ; wmctrl -i -a $FOCUSWIN"
#osso-xterm "$FOCUSCMD"

sudo debian qobi-wmhint-fix $FOCUSWIN
wmctrl -i -a $FOCUSWIN
