Shoes does this. http://shoesrb.com/

It's a complicated, hard problem, though. I'm actually sort of starting to
work on a more generic solution, I have a github repo set up but not a ton
actually done yet. I plan on extracting the stuff out of Shoes and making it
a bit more generally applicable.

http://github.com/steveklabnik/furoshiki