I use my Mac as a Home Media PC - it’s my only “TV.” It’s cabled to a projector/home theater setup.
To stop the projector from being seen as a display all the time and having windows get lost over there, I bought SwitchResX http://www.madrau.com (which has an AS dictionary) and use it to disable and enable the projector as needed.
This worked great under Mavericks. Under Sierra, Apple broke the “disable display” functionality, so it no longer behaves the same as unplugging the display. (I checked with the SwitchResX developer, this was Apple). If I physically unplug the display, any application windows that were on the now-unplugged-display move back to the active displays .Setting a display to inactive via software used to do the same thing under Mavericks, but no longer does under Sierra. It becomes impossible to drag new windows onto the disabled display, but existing windows don’t come back, and creating a new window it can be created on the disabled display.
I don’t understand why, but all the time now, without dragging a window over to it or anything (I can’t even when it’s disabled), Safari and Finder decide that any new window I make will go to the turned-off and “disabled” projector, so those applications become unusable.
Any thoughts on the feasibility of an Applescript solution? A script that can round up windows based on which display they’re on and move them to an active display? I’ve done some Googling, but haven’t found any access to that kind of information/functionality.
The developer indicated a lot of people are in the same boat I am, so it would be nice if I could make available any solution I can come up with.