Skip to content

fix: unplugging a 2nd monitor locks the mac - #24

Merged
fanckush merged 3 commits into
fanckush:mainfrom
lbb-seu:fix/avoid-forced-display-sleep
Nov 20, 2026
Merged

fanckush merged 3 commits into
fanckush:mainfrom
lbb-seu:fix/avoid-forced-display-sleep

Conversation

@lbb-seu

@lbb-seu lbb-seu commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Problem

In External Only mode, a display removal can queue a global sleep/wake refresh. On a MacBook Air M5 with two external displays, locking the Mac could produce a loop: the system blanked the displays, SoloDisplay emitted SoloDisplay redraw about two seconds later, and the displays lit again. With the session unlocked, unplugging an external display could also force the remaining display to sleep and trigger the lock screen.

To reproduce the original lock-screen issue, enable External Only, lock the Mac manually, wait for the displays to sleep, and check whether they wake without user input. To exercise the unplug case, keep one external display connected while disconnecting the other. No remote desktop software is needed to reproduce the lock-screen issue.

Change

Disable forced redraw in the app's controller policy. Leave external display detection, External Only behavior, and restoration of the built-in display when the last external is unplugged unchanged. Add a controller regression covering repeated display removal/return and last-external unplug with forced redraw disabled.

Verification and trade-off

  • A local build with the same behavior was tested on a MacBook Air M5 with two 4K external displays. Manual lock and display sleep did not loop; unplugging one external did not force another sleep or lock; unplugging the last external restored the built-in display.
  • The existing workaround for an external display showing only the cursor is no longer triggered automatically. That symptom did not reproduce in this hardware test. This patch does not diagnose or claim to fix a monitor reporting no signal.
  • Maintainer feedback welcome: is disabling the global refresh in the app the right default, or should we preserve it only behind a more specific trigger?

@fanckush

Copy link
Copy Markdown
Owner

@lbb-seu thank for the PR, is it ready for review? it's still a draft so i'm not sure

@fanckush

Copy link
Copy Markdown
Owner

ok I ran this, and it's really valuable! also i've had this bug for while (with one monitor) here my mac wakes up from sleep and I didn't even think that it was because of SD.
i added some commits that slightly change the fix! thx again, will merge now

@fanckush
fanckush marked this pull request as ready for review November 20, 2026 11:47
@fanckush fanckush changed the title fix: avoid forced display sleep during hot-plug fix: unplugging a 2nd monitor locks the mac Nov 20, 2026
@fanckush
fanckush merged commit 0806d46 into fanckush:main Nov 20, 2026
6 checks passed
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.

2 participants