I do something similar:
TMPFILE=/tmp/dwm-lastwindow
xdotool getwindowfocus > $TMPFILE
foo=$(xdotool search --class st)
if [[ $foo != "" ]]; then
xdotool windowactivate $foo
else
st -e tmux-start &
fi-- sic dicit magister P University of Toronto / Fordham University Collins Hall B06; Office Hours TF10-12 http://individual.utoronto.ca/peterjh gpg --keyserver pgp.mit.edu --recv-keys E0DBD3D6
