#!/bin/sh

[ ! -f /tmp/scratchpad ] && echo invalid > /tmp/scratchpad

WID="$(cat /tmp/scratchpad | sed 's/0x//g')"
if wmctrl -l | fgrep -q "${WID}";
then
    wmctrl -i -R 0x${WID} -b toggle,hidden,above,sticky
else
    WID=$(tabbed -c -d -n scratchpad -g 1280x768+300+120 -r 2 st -w '')
    echo ${WID} > /tmp/scratchpad
fi
