#!/bin/bash
#############################################
#                                           #
#  Starts or switch to an application.      #
#                                           #
#  Koentje  (remon@cobrasoft.nl)            #
#                                           #
#############################################
#
# Application to start
app="/usr/bin/firefox"
#
# Windowname of application  (get it with  "wmctrl -l")
wname="Mozilla Firefox"
#
#
###############################################################
############## do not change after this line ##################
###############################################################

isactive=$(wmctrl -l | grep "$wname")

if [ "$isactive" = "" ]; then
  "$app" &
else
  xdotool windowactivate $(wmctrl -l | grep "$wname" | awk '{print $1}')
fi
exit 0
