Skip to content

bugfix: Restore notches on external displays after sleep/wake - #431

Open
itradesize wants to merge 1 commit into
vinzdg:mainfrom
itradesize:fix/display-wake-reconciliation
Open

itradesize wants to merge 1 commit into
vinzdg:mainfrom
itradesize:fix/display-wake-reconciliation

Conversation

@itradesize

Copy link
Copy Markdown

Problem

After sleep/wake or a display topology change, macOS can replace
NSScreen instances while preserving their display identifiers.

In All displays mode, NotchFleet retained existing controllers
based on stable display keys, but did not update their assigned
NSScreen references.

As a result, controllers could fall back to the preferred display,
causing multiple notch panels to appear on the same monitor.

Root cause

The issue was reproduced on a four-display setup.

Diagnostic logging confirmed:

  • Screen object identity changed while the display key remained stable.
  • Retained controllers kept stale screen references.
  • The stale assigned screens were no longer present in NSScreen.screens.
  • Screen resolution fell back to the preferred display.

Fix

  • Rebind retained controllers to the current NSScreen instance.
  • Relocate panels to their correct displays.
  • Preserve existing controllers and their view models.
  • Keep reconciliation idempotent.
  • Handle temporary display topology changes during wake.

No wake-specific delays, timers, or polling were introduced.

Tests

Added regression coverage for:

  • Replacement NSScreen instances with stable display keys.
  • Controller and model preservation.
  • Temporary topology shrink and return.
  • Always Show restoration on recreated controllers.
  • Correct per-display assignments.
  • Idempotent reconciliation.

Validation

  • make build: PASS
  • make test: 2,122 passed, 6 skipped, 1 failed.

The single failure is a pre-existing hardware-dependent test:

EverySizeSettingAppliesEverywhereTests.testTheSizeSettingSurvivesTheHardwareEdge()

The same failure was confirmed on the clean baseline before this change.

Physical validation was performed on a four-display Mac setup.
The original issue was reproduced before the fix, and subsequent
real-world sleep/wake testing confirmed correct display assignments.

@itradesize
itradesize force-pushed the fix/display-wake-reconciliation branch from d783ea7 to 9e1d8cb Compare October 9, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant