unlocking laptop moves all windows to primary display

I have a macbook pro. I have it hooked up to a second monitor. I have the primary display marked as the laptop screen.

When i unlock the macbook or wake it up from sleep, it moves all my open windows to the primary monitor. Is there a way to keep my windows where they are after waking up or unlocking?

I saw stay, but i am not paying $15 for a feature that should be in the OS. And it has lots of reviews saying it just doesn't work as expected.


It does it because the external display isn't waking up fast enough to register with the Mac.

Not sure there's any way to fix that unless you can try wake it manually first.