Here are a few small snippets for wmii (mostly only work on linux):

these are for wmii version 3.5, using plan9ports.