Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

velocityg4

macrumors 604
Original poster
Dec 19, 2004
7,345
4,732
Georgia
A customer is having issues with multiple displays on an iMac. When waking from sleep the windows are all shuffled around. Sometimes they are all stacked on one screen. Stacked on a couple screens. Or stacked on a couple screens but a few in the right places on all screens.

I've tried to remote in and fiddle with Mission Control.
1. Off "Automatically rearrange spaces on most recent use"
2. On "When switching to an application, switch to a Space with open windows for the application"
3. Off "Group windows by application"
4. On "Displays have separate Spaces"

I've just switched (2) to off to see if that corrects the issue. If it doesn't. I want to find out which app in my title does the best job locking in window positions. So, when they wake from display sleep (iMac itself is always on). Everything can quickly be restored to their correct positions.

Display Maid, SwitchresX and Stay are the only ones I've found. Which seem to perform this function. But the reviews are mixed on how reliably they work. Each external display are LG 4K 27" Thunderbolt displays connected via Thunderbolt to a 2017 iMac 5K on Big Sur.
 

I use Moom for this.
How complex is it?
Can you just position all the windows then choose an option to remember all window positions?

I saw Moom before but wasn’t sure about it. As the description on their page makes it sound complex.
 
Can you just position all the windows then choose an option to remember all window positions?
Yes exactly... pretty easy once you get it setup.

I have it set to auto arrange everything when I go to clamshell mode and attach my external monitor.

For your use case, I think it would be easiest to setup a hotkey. So when things get out of place, hit the hotkey and it will move everything to the saved positions.

Screen Shot 2022-02-10 at 9.08.03 AM.png
 
Last edited:
  • Like
Reactions: velocityg4
Yes exactly... pretty easy once you get it setup.

I have it set to auto arrange everything when I go to clamshell mode and attach my external monitor.

For your use case, I think it would be easiest to setup a hotkey. So when get out of place, hit the hotkey and it will move everything to the saved positions.

View attachment 1957036
Awesome, that sounds like it may work out. I guess those two line items "Laptop Size" and "Desktop Size" are your saved layouts.

I was just concerned he'd have to manually flag each window and put them together as a group for saving. As that's what their website description made it sound like.
 
I have used both Stay and Display Maid extensively. Stay is very stable but slow to restore window position (around 3 secs). Display Maid is faster but not as stable.
 
  • Like
Reactions: velocityg4
I have used both Stay and Display Maid extensively. Stay is very stable but slow to restore window position (around 3 secs). Display Maid is faster but not as stable.
Good to know. Stable is certainly better than fast. Three seconds isn't too bad. At least compared to doing it manually.
 
Yes exactly... pretty easy once you get it setup.

I have it set to auto arrange everything when I go to clamshell mode and attach my external monitor.

For your use case, I think it would be easiest to setup a hotkey. So when things get out of place, hit the hotkey and it will move everything to the saved positions.

View attachment 1957036

I just found this thread because I have a MBP that I often use in clamshell mode with an ASD. Whenever I plug it in and close the lid so that the ASD is now the only monitor, the application windows end up on the side or bottom of the screen.

I installed Moom and tried to set it up so that it remembers the window positions when the MBP is plugged into the ASD. However, it is not working. Here is how I set it up:

2022-08-16_13-30-37.png

Trigger automatically is set to "When the display layout matches 2560x1440.

But when I plug in my MBP and close the lid, the windows on the ASD don't go back to where they were when I did the snapshot. Or at least not all of them. Brave (browser) is in the right place, but a lot of my other apps are not. Any ideas?
 
Hmmm... I have it setup the same way and it works. No idea what is up there.

Does it work when you manually hit the hotkey?
Yes, it works if I manually invoke it from the menu or hit the hotkey.

But it's not automatically working when I connect the MBP to the ASD and close the lid. I assumed that choosing the "Trigger automatically when the display layout matches 2560 x 1440" would make it work automatically. I also tried "Trigger automatically when switching to 1 display", but that isn't working either.

Is it triggering automatically for you when you're in clamshell mode? I'll reach out to the developer, but based on reviews, it doesn't seem likely I'll get a response.

2022-08-17_15-18-33.png
 
I'm kind of an Alfred noobie... not that familiar with workflows. Do I need to assign a hotkey? How do I tell it which snapshot to open?

I see this code in the AppleScript:
on alfred_script(q) tell application "Moom" arrange windows according to snapshot named q end tell end alfred_script

Do I need to change "q" to the name of the snapshot?

And if I want to create a desktop and laptop version, as you seem to have, do I need two versions of this workflow?

Thanks again for your help!
 
You don't need to do anything with that script/code. Just install the Workflow then in Alfred type moom and it should show any saved snapshots you have setup in the Moom app like in my screenshot up in post #12. No need for multiple instances of the Workflow.
 
That's weird. When I invoke Alfred and type Moom, the only option I see it to open the app:

2022-08-18_11-16-10.png


I do have a snapshot setup:

2022-08-18_11-16-48.png
 
I have the same issue with window positions not restoring after sleep. I recently learned that the problem doesn't appear for any applications which were hidden when your computer sleeps. So I wrote an application to take advantage of this. You can download the application here (free).

I call the application Sandman because it puts it's children to sleep. Unzip and run the application. It should put itself into the background and operate quietly. All it does is listen out for wake & sleep notifications from the computer and the screens, and simply hides and shows applications at appropriate times.

It may not work for everyone. To understand more, there are two main scenarios:
  1. Your computer sleeps before your monitors do. This is my setup, so this is the most tested scenario. The program works flawlessly for me with two monitors on a Mac Studio (Monterey 12.4).
  2. Your monitors sleep before your computer sleeps. This scenario is less tested.
Limitations:
  1. Sandman will not work if System Preferences is the active (front) application when sleeping. This is intentional, and it is to avoid issues when you are rearranging your screens in the Displays preference pane.
  2. Sandman does not work when you log out or restart. It only works for sleep.
Hopefully this helps others.
 
  • Like
Reactions: Weaselboy
I have the same issue with window positions not restoring after sleep. I recently learned that the problem doesn't appear for any applications which were hidden when your computer sleeps. So I wrote an application to take advantage of this. You can download the application here (free).

I call the application Sandman because it puts it's children to sleep. Unzip and run the application. It should put itself into the background and operate quietly. All it does is listen out for wake & sleep notifications from the computer and the screens, and simply hides and shows applications at appropriate times.

It may not work for everyone. To understand more, there are two main scenarios:
  1. Your computer sleeps before your monitors do. This is my setup, so this is the most tested scenario. The program works flawlessly for me with two monitors on a Mac Studio (Monterey 12.4).
  2. Your monitors sleep before your computer sleeps. This scenario is less tested.
Limitations:
  1. Sandman will not work if System Preferences is the active (front) application when sleeping. This is intentional, and it is to avoid issues when you are rearranging your screens in the Displays preference pane.
  2. Sandman does not work when you log out or restart. It only works for sleep.
Hopefully this helps others.
Thanks! This looks great, and it answers a question I had. I noticed that some applications restored positions after sleep, and others didn't—but I wasn't sure why. Now I understand that it's the hidden applications that don't restore. I'll give this a try and let you know how it goes!

When my MacBook Pro is connected to my Apple Studio Display, it is *always* in clamshell mode, and I have it set to never go to sleep automatically. When I'm finished working, I use Alfred to invoke sleep manually. In this scenario, will my computer sleep before my monitor does?
 
Thanks! This looks great, and it answers a question I had. I noticed that some applications restored positions after sleep, and others didn't—but I wasn't sure why. Now I understand that it's the hidden applications that don't restore. I'll give this a try and let you know how it goes!

When my MacBook Pro is connected to my Apple Studio Display, it is *always* in clamshell mode, and I have it set to never go to sleep automatically. When I'm finished working, I use Alfred to invoke sleep manually. In this scenario, will my computer sleep before my monitor does?
Sorry, I couldn't say which will sleep first without access to your computers and xCode. I just know both occur from testing on a Mac Studio and MacMini M1. The difference could be in the monitors, not the computer even. (Both on 12.4).
 
Sorry, I couldn't say which will sleep first without access to your computers and xCode. I just know both occur from testing on a Mac Studio and MacMini M1. The difference could be in the monitors, not the computer even. (Both on 12.4).
How does this work? Should I add it to login items so it's always running?
 
How does this work? Should I add it to login items so it's always running?
Hi, that would be a good idea. I've updated the software slightly, and created a web page so the latest version can be downloaded from a single place. See next post.

How it works is mentioned briefly on the website. It listens out for wake and sleep notifications (of the displays and your monitors) and hides and shows the applications so they are always hidden while asleep. The waking determination isn't perfect, so in the newer version there is a button to click to complete the process.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.