Desktop arrangement lost after waking from sleep

MacOS Monterey 12.2.1 / MacBook Pro (16-inch, 2021) / Apple M1 Pro


I have two additional monitors (BenQ PD2725U Displays) and the multiple display setup works fine.

On display #3 there are three "Desktops" each devoted to a different app.


After the system wakes from sleep, the Desktops from #3 all switch to display #2, and all the application windows on display #3 migrate to display #1.


It's disruptive and time-wasting to have to re-set my workflow configuration every time. I've resorted to disabling all the energy saving features. Can anyone recommend a fix?



MacBook Pro

Posted on Mar 5, 2022 5:46 AM

Reply
Question marked as Top-ranking reply

Posted on Jul 20, 2022 4:40 AM

Looks like I have a fix, after 1h call with support and some experimenting.

Step 1: create different local user and check if problem occurs again. For me, it didn't.

Option with new user is nor really good for me, as it means another onboarding process with my corporate, means new device ID, certificates, blahblah.

Step 2: shut down Mac, ten tap and hold power button for Startup options, choose options -> disk utility, and check Macintosh HD for errors -> "health check". For me, it didn't find anything.

Step 3: (being logged into your user) Finder -> Go-> Library -> LaunchAgents, delete everything inside, not the folder itself.

Step 4: go to Macintosh HD -> Library -> LaunchDaemons, delete everything inside, not the folder itself.

Restart Mac.

Now sleeping and waking, unplugging and plugging back - all app windows are back where I left off. Finally.


Similar questions

121 replies
Question marked as Top-ranking reply

Jul 20, 2022 4:40 AM in response to Blazejos

Looks like I have a fix, after 1h call with support and some experimenting.

Step 1: create different local user and check if problem occurs again. For me, it didn't.

Option with new user is nor really good for me, as it means another onboarding process with my corporate, means new device ID, certificates, blahblah.

Step 2: shut down Mac, ten tap and hold power button for Startup options, choose options -> disk utility, and check Macintosh HD for errors -> "health check". For me, it didn't find anything.

Step 3: (being logged into your user) Finder -> Go-> Library -> LaunchAgents, delete everything inside, not the folder itself.

Step 4: go to Macintosh HD -> Library -> LaunchDaemons, delete everything inside, not the folder itself.

Restart Mac.

Now sleeping and waking, unplugging and plugging back - all app windows are back where I left off. Finally.


Mar 5, 2022 10:59 AM in response to tomgiebel

It could be that #3 takes a bit longer to wake from sleep, and since it initially isn't detected (asleep) the open windows shift to other displays that are sensed. You could try disabling sleep on just #3 to see if that helps, as if it is always on it won't experience that delay.


You could also revisit the cabling arrangement, which display uses which cable or goes through a dock or hub. That can also affect the order of waking up.

Aug 9, 2022 8:09 AM in response to tomgiebel

An obnoxious solution that actually worked for me is ensuring that i allow the external monitors to completely wake before signing back in.


That means you need to make sure that when you come back from sleep, you are presented with a login screen. Then wake the computer; allow all the screens to wake up; and THEN login.


The core problem seems to be that the OS doesn't care about external monitors being there or not and makes no effort to check for their existence before attempting to arrange windows for the user at login; which in that split moment only has the one monitor.

Aug 20, 2022 7:58 AM in response to tomgiebel

I've had this problem for years with pre-M1 Macbooks and shockingly the M1's have still not fixed the problem. They likely never will since it's a 3rd party hardware issue with the timing of the external monitors waking separately from the CPU waking back up. But fortunately I found a great application a while back that works almost perfectly called Stay.


https://apps.apple.com/us/app/stay/id435410196?mt=12


You can store window layouts across all applications or with only certain applications from the toolbar and set it to automatically restore window layouts on wake. If you're like me an d have a number of different spaces set up with relatively consistent layout needs this sets all of my spaces exactly how I want on every wake. If you're changing your layouts often you'll have to remember to hit the "Store Windows" action from the toolbar before putting to sleep, but it only takes a second. It's $15 which isn't ideal but I've been using it for years and the frustration it's saved me has been well worth the price.

Aug 12, 2022 11:22 PM in response to tomgiebel

Hey there!


I've resolved similar issues with these steps:


From these three locations, delete any files that show: "WindowsServer.plist". (There maybe several in each location).


~/Library/Preferences/WindowsServer.plist

~/Library/Preferences/ByHost/WindowsServer.plist

/Library/Preferences/WindowsServer.plist


Restart and test it out.


To get to the ~/Library:

Open Finder, while holding the Option key, click Go > Library, from the top menu.


To get to the /Library:

Open Finder, click Go, also on the top menu > Computer > Macintosh HD > Library.


If it's not an issue with the hardware configuration, this may fix it, good luck!

Aug 14, 2022 1:43 AM in response to tomgiebel

I have two, 32 inch 1080p external monitors connected to my mac. I never had a problem until I upgraded to Monterey, and for some reason the windows would be in the wrong places after I wake up the computer.

I found that my USB-c dongles were bottlenecks for the HDMI cables. Changing my cables to display port to USB-c cables (so no dongle) fixed my problem immediately, and the desktop windows are all in the right places.

It also depends on what kind of monitor you have. If you have 4k or 120hz monitor, you should try to get an HDMI 2.0+.

Hope that helps.

Aug 18, 2022 9:17 AM in response to tomgiebel

It's definitely not ideal but I think I found a work-around. And I don't know if everyone's version of the problem is the same as mine. But I think it has to do with the weird issue that Macs have with only effectively supporting multiple monitors via different USB-C ports. Mainly that Macs seem to have troubles when multiple monitors are connected via HDMIs through a hub to one USB-C port on the Mac. Which is a HUGE issue because Macs always always always have too few USB-C ports. Buuuuut, on my previous MacBook Pro it was never an issue. I was using 2 Adam hubs each connected to one USB-C port and that each had an input for an HDMI from one external monitor. The MacBook Pro had 4 USB-C ports so that worked well. But I recently bought a new MacBook Pro and I realized after I bought it that it only had 3 USB-C ports and I've been struggling to use all my peripherals/accessories. So I bought a J5 Create hub with 2 HDMI ports and it worked to share to multiple screens but I started having this issue with losing my monitor set-up every time the computer slept, restarted, or shut down. I connected 1 of my external monitors through the Adam Hub using a separate USB-C and left the other external monitor on the J5 hub and now, the system keeps the settings and my open windows are now on the correct monitor every time. It sucks because now I have no open USB-C slots but I guess it's my own fault because I missed this issue (and other ones too) when i bought my new MacBook Pro. This is supposed to be an upgrade (I got one with an M1) but there is A LOT that is not better than my old MacBook Pro. You live you learn. When I update again I will verify every single minute detail of the system to make sure it is actually better.

Dec 19, 2022 8:47 AM in response to tomgiebel

I have a couple solutions depending on which situation relates more closely to your situation.


I ran into 2 separate problems that I found fixes for.


Problem 1: Display settings swapped completely between 2 monitors. 2 identical external monitors, and my M1 MBP failed to recognize which monitor Is which, therefor swapping the orientation of my monitors in the opposite position I wanted every time the Mac wakes/unlocks.


Solution 1: connect the monitors via 2 different connection types. I initially had them both connected via HDMI, but switching one to USC-C (and leaving the other as HDMI) allowed my Mac to differentiate between the two, ending my problem of display settings swapping between the two monitors.


Problem 2: every time my Mac goes to sleep, all windows migrate to my 'main display'. When I re-wake, the windows do not automatically reposition themselves on the correct monitor.


Solution 2: I previously unchecked 'Automatically rearrange Spaces based on most recent use' per previous threads guidance - and it solved the problem for me at the time, but for whatever reason, after I updated to Ventura, the problem came back. I simply re-checked "Automatically rearrange Spaces based on most recent use' and the problem seems to be fixed. Now, every time I re-wake/re-login, the windows go back to their corresponding monitor where they were left.


Hoping this helps

Sep 17, 2022 6:05 PM in response to fmarquez

I had a long call with Apple Support yesterday. They recommended un-checking the "Automatically rearrange Spaces based on most recent use" (Number 1 below) and checking the "Displays have separate Spaces" (Number 2 below) under the Mission Control in the System Preferences.


Below is a screenshot of what I've done by following their advise.




See if this solution helps any of you?

Few hours passed and so far its steadily holding up.

Aug 9, 2022 7:22 PM in response to gdoteof

That means you need to make sure that when you come back from sleep, you are presented with a login screen. Then wake the computer; allow all the screens to wake up; and THEN login.


This simple (but still annoying) little solution helped to resolve most of my issues. I keep several windows of Chrome/Word/Excel/etc open with different projects/information on different desktops. It was driving me crazy to have to redistribute every time my new M1 MacBook took a nap. If I can just be patient, and wake my (very fancy) MacBook Pro slowly, like a sleep deprived toddler, it seems to remember which window belongs to which desktop. Maybe part of the problem is going through a mini-display port to USB-C adapter?


While it does seem to remember everything after waking from sleep, it still forgets some app locations after a full restart. For instance, it relocated InDesign, Word, and Excel windows after a restart. Maybe I could assign these to a certain desktop. But it was still able to keep all of my Chrome windows (all seven of them) in the right desktop/space.


Tomorrow I need to go into my office, where I have a different monitor setup. We'll see how that goes.

Sep 28, 2022 1:55 PM in response to tomgiebel

I had this problem also. After reading the various responses that indicated it might be timing-related, I realized that I was accessing my 2ndary monitor through an HDMI cable attached to a (Tripp-LITE) USB-C hub (multi-purpose dongle).


I guessed that the USB-C hub might be too slow, so I connected my HDMI cable directly to an HDMI-to-USB-C dongle, and that fixed the problem for me. Fortunately, I had a spare USB-C port available.

Aug 12, 2022 1:07 PM in response to Blazejos

Step 3: (being logged into your user) Finder -> Go-> Library -> LaunchAgents, delete everything inside, not the folder itself.

Step 4: go to Macintosh HD -> Library -> LaunchDaemons, delete everything inside, not the folder itself.

Restart Mac.

Blazejos wrote:

Looks like I have a fix, after 1h call with support and some experimenting.
Step 1: create different local user and check if problem occurs again. For me, it didn't.
Option with new user is nor really good for me, as it means another onboarding process with my corporate, means new device ID, certificates, blahblah.
Step 2: shut down Mac, ten tap and hold power button for Startup options, choose options -> disk utility, and check Macintosh HD for errors -> "health check". For me, it didn't find anything.
Step 3: (being logged into your user) Finder -> Go-> Library -> LaunchAgents, delete everything inside, not the folder itself.
Step 4: go to Macintosh HD -> Library -> LaunchDaemons, delete everything inside, not the folder itself.
Restart Mac.
Now sleeping and waking, unplugging and plugging back - all app windows are back where I left off. Finally.

If this issue is indeed caused by certain launch agents or launch daemons, it would be helpful to narrow down the scope of possible culprits. Do you (@Blazejos) remember what was in those folders before you deleted the contents? Did you add anything back without the issue reoccurring?

Sep 1, 2022 7:27 PM in response to tomgiebel

This has been annoying me for months too.

I finally found the solution by installing a 3rd party app called SwitchResX.


It's annoying to have to resort to a third party app, and this app is probably overkill for this one feature. But it's worked for me.


It's explained in more detail in the last point on this article which does have some other solutions as well, but this was the only one that worked for me. https://gadgetstouse.com/blog/2022/07/23/mac-forgets-dual-monitor-arrangement/


Oct 7, 2022 7:30 PM in response to ender1598

Today I found something new around this issue...

My monitors have a 45sec wait time after Mac stopping sending video signal before it goes onto stand-by mode (ie: I lock the screen and close the lid).


Here's what I noticed:

1) If the external two monitors were in stand-by mode when mac was waking up, Mac knows how to arrange the screens correctly (It'll order the signal start so that each monitor gets the last state correctly).

2) But if I re-login while the monitors are in that 45sec window (waiting for a signal) -- then everything is mixed up (Both the screen order and app-windows' placements are all mixed up).


So waiting for both screens to goto stand by mode fully, and then waking up, Mac seem to be keep the order.


It is annoying having to bother about this issue this much, but this finding so far seems useful to me.

But fingers crossed and am not sure if this is a 100% scenario given my past experience with the "solutions" to this nasty problem....


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Desktop arrangement lost after waking from sleep

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.