views:

3063

answers:

4

Whenever I use my MacBook away from my desk and later plug it into an external display (as primary), I get into the state of having windows deposited in both the notebook monitor and the external one.

To move all windows to a single screen, my current solution is to "Turn on mirroring" in the display preferences and then turn it off again. This is rather tedious, though. Does anyone know of a better way?


I'm afraid the script posted by @erlando does absolutely nothing for me, running Mac OS X 10.5.4. (I.e., with windows on both screens, running the script moves not a single one of them, and it does not return any errors.) I guess I'll just have to stick with using the "mirror/unmirror" method mentioned above.


@Denton: I'm afraid those links provide scripts for getting windows which are orphaned from any screen back onto the display. I ‘just’ want to move all windows from a secondary display onto the primary display.

+3  A: 

Here is a command-line script to do just that: http://zach.in.tu-clausthal.de/software/.

It's a little down the page under "Move Off-Screen Windows to the Main Screen".

erlando
A: 

There is an article on using AppleScript to do this at macosxtips.co.uk, and another at macosxhints.com.

DGentry
A: 

You can click the "Gather Windows" button in the Displays preference pane.

Zydeco
A: 

@Zydeco That only gathers the windows from the Displays pref. :-) (At least, on 10.6, it fails to gather Terminal windows.)

ChrisD
Yup, true that. Not sure if it's a bug or a feature, so to speak.
Will Robertson