Skip to content

Fix internal display toggle not re-applied after resume#5736

Open
mat-ran wants to merge 3 commits into
basecamp:devfrom
mat-ran:fix/monitor-toggle-on-screen-wake
Open

Fix internal display toggle not re-applied after resume#5736
mat-ran wants to merge 3 commits into
basecamp:devfrom
mat-ran:fix/monitor-toggle-on-screen-wake

Conversation

@mat-ran
Copy link
Copy Markdown

@mat-ran mat-ran commented May 10, 2026

Problem

When you disable the internal laptop display while an external monitor is connected, then trigger display sleep (screen off) and wake the laptop, the internal display incorrectly turns back on - even though nothing changed with the external monitor connection.
The expected behavior: the internal display should stay disabled after wake, as long as the external monitor remains connected. This works correctly with systemctl suspend, but fails with display sleep.

Root Cause

When the screen turns off (display sleep), the external monitor loses signal due to no input and Hyprland sends a monitorremoved event. Shortly after, when the laptop wakes, the external monitor takes a moment to be detected again. The monitor watcher would immediately try to "recover" the internal display without waiting for the external monitor to reappear on wake, causing a race condition where the internal display gets turned back on before the external monitor is detected.

Solution

  1. recover() now waits up to 3 seconds - before re-enabling the internal display, it polls for external monitors to give the system time to detect them on wake
  2. Added reapply() function - to properly refresh the toggle state when monitors are reconnected
  3. Added monitoradded event handling - ensures toggle state is maintained when monitors are added

Probably fixes #5481

Copilot AI review requested due to automatic review settings May 10, 2026 17:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mat-ran mat-ran force-pushed the fix/monitor-toggle-on-screen-wake branch from d8b7135 to c5e60de Compare May 10, 2026 17:21
@mat-ran mat-ran changed the title Fix internal display toggle not re-applied after suspend/resume Fix internal display toggle not re-applied after resume May 10, 2026
Copilot AI review requested due to automatic review settings May 11, 2026 07:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

@dhh
Copy link
Copy Markdown
Member

dhh commented May 11, 2026

I tried a few different ways with this and was able to end up with the internal display turned off when I unplugged the external. I think we need some more testing to make sure this is fully solid.

@mat-ran
Copy link
Copy Markdown
Author

mat-ran commented May 11, 2026

I'll check it out. In what situations has the built-in monitor failed to turn on?

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.

Internal display toggle not re-applied after suspend/resume

3 participants