Mac app / 2026 / In progress
MonitorMate.
A Mac app that puts a saved monitor layout back after sleep or a reconnect, and leaves changes made on purpose alone
- The hard part
- Telling displays that slipped out of place after sleep or a reconnect from displays you moved on purpose.
- Works today
- The restore rules and the Keep and Revert fix are written, and I checked them by reading the code, not yet on real monitors.
- Role
- Software engineering
- Built with
- Swift · SwiftUI · AppKit · Combine · CoreGraphics · JSON · XcodeGen
01What I built
The problem.
Extra monitors can come back in the wrong places after a Mac wakes or a cable is plugged back in. A tool could simply force a saved layout back every time. But that would also undo a change you made on purpose in System Settings. A quick unplug and replug can also end with exactly the same displays as before. Then the list of displays looks unchanged, so comparing the list shows nothing.
What I built.
MonitorMate first works out which displays are connected. Then it finds the saved profile, a small A technical wordJSONA common text format that programs use to send each other structured data. text file, for exactly that set of displays. Before it puts the layout back, it checks whether any display has moved out of place. It moves the displays through Core Graphics, the part of macOS that controls them. When displays change, macOS sends a quick burst of signals. MonitorMate waits 1.5 seconds for them to settle, and keeps a note of why it needs to check. You change a layout by hand in a separate draft. The draft has three buttons, Apply, Keep and Revert, and a ten-second countdown.
The app
Swift, SwiftUI, AppKit, Combine, Core Graphics
- Settle timer
- Gathers the display signals from macOS for 1.5 seconds. It remembers if any of them came from a wake or a reconnect.The storyNoticing a monitor reconnect when the display list looks unchanged
- Profile store
- Saves each layout as a small text file. It finds the right one for the current setup by a fixed fingerprint for each display.The storySaving only the display layout you choose to keep
- Auto-fix rules
- Checks what caused the change, the main auto-fix setting and the matching profile. Then it checks that no layout is already being applied, and that the displays really moved.The storyNoticing a monitor reconnect when the display list looks unchanged
- Display service
- Places the main display at the zero point the others are measured from. Then it asks macOS to move the displays, and reports any failure.
- Layout draft
- Keeps three things apart. These are the draft you are editing, the layout you had before and the saved profile.The storySaving only the display layout you choose to keep
02The journey
What broke, and what changed.
Broke, then fixedA decisionA milestone
- 01 of 04Decided
Put a layout back only for an exact match, and only after a real change
The questionMonitorMate keeps a saved profileMonitorMate · The appProfile storeSaves each layout as a small text file. It finds the right one for the current setup by a fixed fingerprint for each display.See it in the map above, a layout, for each set of displays. But a layout that differs from its profile is not always a mistake. I may have moved the displays on purpose. Or I may have plugged in a different set of monitors.
What I choseSo a profile is used only when three things are true. Every connected display matches the profile. The Mac has woken, or a display was connected or removed. And the displays have moved out of placeMonitorMate · The appAuto-fix rulesChecks what caused the change, the main auto-fix setting and the matching profile. Then it checks that no layout is already being applied, and that the displays really moved.See it in the map above. The cost is that I need a profile for each setup.
- 02 of 04Broke
A quick reconnect looked like nothing had happened
What went wrongA quick unplug and replug can end with the same displays as before, but in the wrong places. MonitorMate only compared the list of displays at the end. That list looked unchanged, so it gave no reason to check the layout.
What changedThe settle timerMonitorMate · The appSettle timerGathers the display signals from macOS for 1.5 seconds. It remembers if any of them came from a wake or a reconnect.See it in the map above waits 1.5 seconds for display signals to calm down. During that wait, it now raises a wake flag or a connection flag when one arrives. When the wait ends, it passes the flags on with a fresh list of the displays. So a reconnect that ends with the same displays still gets its layout checked.
- 03 of 04Broke
Revert left the rejected layout in the saved profile
What went wrongYou edit a layout as a draftMonitorMate · The appLayout draftKeeps three things apart. These are the draft you are editing, the layout you had before and the saved profile.See it in the map above, then press Apply to try it. Apply saved the draft into the profileMonitorMate · The appProfile storeSaves each layout as a small text file. It finds the right one for the current setup by a fixed fingerprint for each display.See it in the map above as soon as it moved the displays. That happened before the ten seconds to confirm had ended. Revert put the screens back, but the rejected draft stayed saved. So a later restore could use it.
What changedI moved the save from Apply to Keep. Keep is also what the countdown chooses when it runs out. Apply now notes the layout you had before. Revert puts that layout back and does not save the draft.
- 04 of 04Decided
Don’t react to the app’s own changes
The questionWhen MonitorMate moves the displaysMonitorMate · The appDisplay servicePlaces the main display at the zero point the others are measured from. Then it asks macOS to move the displays, and reports any failure.See it in the map above, macOS sends display signals of its own. Those signals should not start another restore straight away.
What I choseSo MonitorMate holds a lockMonitorMate · The appAuto-fix rulesChecks what caused the change, the main auto-fix setting and the matching profile. Then it checks that no layout is already being applied, and that the displays really moved.See it in the map above while it moves the displays and then refreshes its list. Once both are done, it lets go of the lock.
03Today
Where it stands.
I have checked these rules by reading the code, not on real hardware. Next I will test them on real monitors, across different docks and displays. The tests will cover waking from sleep and quick reconnects. They will also cover a missing display and displays moved on purpose.