Can't mirror the main display after closing the MacBook lid

Open
#344 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
macos, rust, swift
Domain
backend, desktop

Research direction

Start with validate_operation_mirrors in Renderer/Bridge/src/actor/bridge/operations.rs and compare its handling of saved mirror blocks with monitor_rows and operation_selector_matches_live_primary. The report identifies a hidden mirror that points at the new main display as the failing case. Add a regression test for making a mirror the main display and then mirroring another display; done means that display change succeeds while the hidden mirror setting remains saved.

Written by the indexing model from the issue text.

Description

area: displays bug review: no-score Sonnet
Area

Displays or Spaces

Wallpaper

Any

What you did
  1. With the MacBook open, set one PHL 272S1 monitor to mirror the main display.
  2. Close the lid. That monitor becomes the main display, and the display list shows every display as independent.
  3. Set the other monitor to mirror the main display.
What went wrong

The app refuses with:

WallpaperMachine.BridgeError.Error(kind: WallpaperMachine.BridgeErrorKind.invalidInput, message: "unknown mirror target for display 2")

Display 2 is the new main display, not the one I changed, and the app log has no entry for the error. I saw this once and couldn't reproduce it later. macOS probably doesn't always pick the mirrored monitor as the new main display when the lid closes.

Cause: The app keeps the mirror setting of the monitor that just became main and hides it in the display list, so the setting can come back once the MacBook is main again. In config.toml that monitor's block still says mode = "mirror" with mirror_target = primary, which now points at the monitor itself. validate_operation_mirrors (Renderer/Bridge/src/actor/bridge/operations.rs) checks every saved mirror block, including the hidden one, so every display change fails until I open the lid again. I found this by reading the code and haven't tested a patched build.

Suggested fix: In validate_operation_mirrors, skip blocks that operation_selector_matches_live_primary matches, as monitor_rows does when it hides them. A regression test could make a mirror the main display and then set another display to mirror.

environment.txt in the report marks display 3 as main because it uses NSScreen.main, the screen with the focused window. The menu-bar display is display 2.

What you expected

The other monitor mirrors the new main display, and the old mirror setting waits until the MacBook is main again.

Diagnostics report

WallpaperMachine-diagnostics-20261203-142713.zip

Details from the app

No response

App version

1.18.0 (71) (macOS 27.2.1)

Dominant language
Swift
Stars
1.3k
Forks
41
Avg merge
4h 46m
Merged PRs (30d)
86

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MMFoundation/WallpaperMachine

All issues in MMFoundation/WallpaperMachine

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.