Fully working (and a few other changes. ewmh was the issue, have removed it as I can't see any valid use for it currently.