How to retrieve windows that have moved 'off-screen'

I have this problem sometimes with my dual-screen setup, especially when I'm juggling lots of things around.

Occasionally I seem to be able to move a window entirely off-screen (I'm not quite sure how) and I can't get it back. If I do a 'hide all' in the application's menu (usually it's Mail.app, so let's stick to that one for the example), everything disappears and Mail seems to think it's got an 'inbox' window in the Windows menu, but there's nothing visible. Closing and restarting the app doesn't seem to help (as the app is helpfully remembering where my window previously was) and all I end up doing is shutting down the Mac, unplugging the second monitor and restarting it, opening the application again and this seems to persuade the Mac to rethink the main window position, and all is well. I can then restart the second monitor, etc.

Is there a better way? Is there some way of marshalling windows back to a specific monitor, or a utility for moving 'open'/running windows? Am I actually doing something wrong? :-)

I'm not using Spaces, by the way - so I'm pretty sure this isn't some weird Spaces issue. :-)


Solution 1:

Chealion answered this on SuperUser.

I won't copy and paste his answer here, as he got the credit not me.

But basically, what you could do is (quoted from Chealion's answer) :

A second method of arranging the Windows so you can see them (if for some reason they're staying off screen) is to change to the application that owns the window in question, hold the Option key down and choose "Arrange in Front" from the Window menu. It will then arrange all the windows of that application in a cascade from the top left of the screen.

Solution 2:

For completeness:

From my answer originally at Server Fault Question 7237:

When a monitor is unplugged (including the adapter as well if applicable - leaving the adapter leaves OS X thinking the monitor is still plugged in) all the Windows should move onto your main screen. Occasionally some windows (eg. Firefox) will keep their position on the very far right of the screen leaving you just enough room to grab the title bar and move it where you'd like to.

One method is before you unplug the external monitor (or before you unplug the dongle) is to open up the Displays Preference Pane in System Preferences and click on the "Gather Windows" button. This is supposed to bring every window on the main screen and the option does not appear if you don't have a second monitor plugged in.

A second method of arranging the Windows so you can see them (if for some reason they're staying off screen) is to change to the application that owns the window in question, hold the Option key down and choose "Arrange in Front" from the Window menu. It will then arrange all the windows of that application in a cascade from the top left of the screen.

Lastly, there are several AppleScripts available (eg. this one at Snipplr) that will also grab every window off screen and move it on screen for you.

There is also a nifty shareware app called Stay that will help automate a lot of this for you, while there is also MarcoPolo which will do much more than just notice if a monitor is disconnected and allows you to run scripts (in case you want to do more than just rearrange the windows).