🖥 Macro to restore window/ desktops position once external monitor is reconnected?

Coming from Windows, this drives me insane.

I build these very nice arrangements with desktops/ spaces for tasks + windows sized and side-by-side...

And then, I wake it from stand-by the next day, and everything is pilled up like crap on the internal desktop... Is there any elegant solution to this?

I use Switchresx for this, but you can probably adapt THIS MACRO to automatically save and restore your window layout, triggered by sleep/wake.

Many thanks for this!! that macro seems really really complex. would you be able to help me with some steps to adapt it? I want to learn the process.

How do you want to adapt it? I've never used it myself, so you should probably ask over on that thread.

If your second monitor is permanently connected this won't happen. I have a Mac Desktop Computer with attached secondary display and on each wake from sleep the windows stay in their previous places on both monitors.

Also, I just tried putting my Mac to sleep. Disconnecting the second display. Reconnecting the second display. And waking from sleep. And all windows were arranged as before.

So, I don't think what you are describing is normal behaviour.

I have this issue too. (Perhaps the situation wasn't described accurately.) When I detach the external monitor and use my MBP away from my desk, all windows re-open on the internal display. They don't go back to where they were previously when you re-attach the external display.

The good news: I tried your macro, Zabobon, and it does what I want. I set up a workspace to position apps for when I have both displays. Then if I re-boot, or re-attach the external display after running without it, I can use the key-stroke to restore the app positions.

Because I have to type a key-stroke, it isn't "automatic", but I don't have to do any adaptation of your macro, either. And I have the flexibility of being able to restore several different app configurations.

I'm happy with it. :smiley:

1 Like

Have a look at the Display Layout Changed trigger -- it might save you a keystroke!

1 Like

Often I'll be doing something completely different when I re-attach the display.

I'll think about it!