Fix accidental revert of window type detection

I managed to accidentally overwrite some changes in the previous commit.
This fixes them.