Add a windowonly generic command and use it where appropriate. Also trim includes and unused.

18 files changed