WIP -- trying to move code from window manager to the app window