I have an M1 MBA that I bring between home and office.
At home, my primary monitor is an external ASUS display, and if it’s open at all, the built-in display is off to the left and decidedly secondary.
At work, the built-in display is my primary screen (laptop sits on a Rain Design mStand), and I have an external Dell off to the right, VESA-mounted on an arm - I do use that fairly often, but it’s a good 60 degrees off to the right, so not really glanceable.
The dock is set up to be in the appropriate place for each location.
What I want:
I would like to automatically move all open windows to the primary display when I change locations - to the internal display at home, and the external monitor at work. And I would like new windows to originate on the primary display by default. (Right now, if I am running Mail at home, close the laptop, and bring it to work, then not only is my Mail window on my external display (not primary at work), but even if I move it to the built-in display, if I hit Cmd-N to start a new email, the window open on the external monitor by default…)
I have gotten part of the way there with Keyboard Maestra - as it turns out, there is a shell script fragment that can detect the hardware description of any external display, and I can match for that to know where I am.
(If you’re curious, it’s:
system_profiler SPDisplaysDataType | grep -B 1 Resolution:
type or paste code here
However, I'm not finding an easy way to move windows en masse to a specific display. I do have Moom 4, which can run custom actions under some circumstances, but I don't see how to move all windows rather than just specific ones. There are some old Applescripts on the KM Discourse that don't seem to work. I'm kind of stumped - any advice would be most welcome.