Implement optional combined window UI

There are no small changes, but this one was for fun. It isn't as big as it looks, because a lot of code was just moved. Review commit-by-commit for easiest reading.

This is currently off by default, and doesn't change the UI (much) in that case. It can be toggled in preferences.