Comment 27 for bug 197209

It turns out that you can do this even a bit more simply. My current script looks like this:

CHVT="`which chvt`"
chvt() {
    killall -s 15 compiz.real
    while pgrep compiz.real; do sleep 0.1; done
    "$CHVT" "$1"
    unset -f chvt

I happen to be running fusion-icon, so when the machine resumes I just select "reload window manager" and I'm all set. As mentioned earlier, it's possible to do something cleaner that restores compiz, but I haven't had the time yet.