MacBook unplugged from external monitor thinks it's still the Secondary Desktop

Command + Brightness Up is the keyboard shortcut for Detect Displays in Lion.


Another way to do this is by going to Displays in System Preferences and then holding down the ⌥ Option key and the Gather Windows button will turn into a button that says Detect Displays.


I've had this with Mavericks a few times, and I found out that in my case changing the Rotation will trigger the OS to recognise the monitor(s) aren't there. Changing the resolution or some other action (besides obvious reboot) didn't seem to work for me.