#!/bin/bash # mfk # # usage: toggle-xterm COMMAND # # if COMMAND is running in an xterm close the term; otherwise start COMMAND in # an xterm. # # requires wmctrl title="|> $@ <|" if wmctrl -l | grep "$title" >/dev/null ; then wmctrl -F -c "$title" else xterm -T "$title" -e $@ & fi