Reliably re-brighten displays that re-register late on screen change.
When docking lid-open while the built-in display was dimmed, the built-in often failed to re-brighten: recovery fired as soon as ANY display became active in Lunar (the externals, which register first), restored only the displays present at that instant, then cleared all state with no retry — so the late-registering built-in was dropped at its dimmed hardware minimum.
Rework screen-change recovery as an incremental poller:
- Track a 'pending' set of displays still owed a restore (seeded from the accumulated restore sources) and restore each one as it reappears, polling until pending is empty or screenChangePollTimeout elapses.
- Re-assert gamma restore whenever a new display appears, clearing any overlay left on a display that re-registered after the initial restoreGamma.
- Verify the full cumulative set of restored displays, and log/drop displays that never return within the timeout (e.g., closed-lid clamshell, unplug).
- finalizeScreenChange is the single teardown/clear point; token guards abort stale callbacks when a new screen change interrupts an in-flight recovery.
Also, harden two adjacent failure modes:
- Suppress the Lunar health-check kill/restart for screenChangeHealthSuppress (30s) after a screen change, since Lunar is legitimately busy (and its CLI may transiently hang) while macOS re-enumerates displays — killing it then would abort recovery.
- Guard dimScreens against starting while a restore is in flight.