Skip to content

Recover monitors Hyprland brought up with no mode - #6701

Merged
dhh merged 1 commit into
quattrofrom
recover-modeless-monitors
Aug 11, 2026
Merged

dhh merged 1 commit into
quattrofrom
recover-modeless-monitors

Conversation

@dhh

@dhh dhh commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #6668.

A monitor powered off when the machine boots still answers DDC, but with a partial EDID carrying no video modes. Hyprland takes the connector as present and brings the monitor up at 0x0. Powering it on afterwards changes nothing — the connector never dropped at DRM level, so no hotplug fires, nothing re-reads the EDID, and the screen stays black until a reboot.

Why a poll, and why it reloads

Only hyprctl reload re-reads the EDID. Forcing a DRM re-probe would work too, but /sys/class/drm/*/status is root-writable only and reads return the cached value, so an unprivileged watcher cannot trigger one — and the kernel's cached mode list stays empty without it. That leaves nothing cheaper to poll: the reload is both the fix and the only way to learn whether it was needed.

Nothing will ask again if the loop gives up, so an unreadable answer is not taken for a healthy monitor — it is also not waited on forever, since a compositor that stays silent has gone along with the session.

So the poll is scoped tightly. It runs only while a monitor is actually in that state, backs off from three seconds to a minute, and stops as soon as one reports a mode. It has to stop itself, since powering the monitor on fires no event to stop on. On a healthy machine nothing runs at all.

Reloading on our own schedule means minding omarchy-hyprland-reload-guard, which keeps Hyprland out of package-owned config mid-transaction and only disables the automatic reloads. It can now be asked, and recovery holds off while a transaction is in flight.

Mirrors are dropped from hyprctl monitors (MonitorState.cpp erases them), so the check asks for monitors all and filters the disabled ones itself. Monitors turned off on purpose sit at 0x0 too, and re-applying config would fight the user over those.

A reload lands a monitor at 0x0 the same way a boot does — powered down while a config edit or package hook reloads Hyprland — so configreloaded is watched alongside the hotplug events. The recovery's own reload comes back through it, which the running loop's pid already makes a no-op.

omarchy-hyprland-monitor-watch already had a poll, but it recovers internal panels on docked laptops and is gated on omarchy-hw-laptop — it never runs on the desktops where this happens.

Note on verification

Covered by tests, including the recovery loop stopping on its own once a mode appears. I could not reproduce the original condition locally, since it needs a monitor powered down through a boot. Worth confirming against the reporter's setup before trusting the interval.

The reporter also mentions their workaround sometimes needed an explicit hl.monitor re-apply on top of the reload. This ships the reload alone; if that turns out to be insufficient in the field, the re-apply is a small addition to the same loop.

They call it a regression between Hyprland 0.55.4 and 0.56.0 in how the DRM backend treats a connected connector whose EDID has no modes. This works around it rather than fixing it, so it may deserve an upstream report too.

— 🤖 Claude, posting on behalf of @dhh

Copilot AI balanced review requested due to automatic review settings August 11, 2026 09:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds automatic recovery for enabled Hyprland monitors stuck at 0x0 after boot.

Changes:

  • Detects enabled monitors without a valid mode.
  • Reloads Hyprland with exponential backoff until recovery.
  • Adds detection and recovery-loop tests.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 2 comments.

File Description
bin/omarchy-hyprland-monitor-modeless Detects enabled 0x0 monitors.
bin/omarchy-hyprland-monitor-watch Adds bounded-backoff recovery polling.
test/shell.d/monitor-modeless-test.sh Tests detection and loop termination.
test/shell.d/monitor-recovery-test.sh Verifies watcher integration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/shell.d/monitor-recovery-test.sh Resolved
Comment thread test/shell.d/monitor-modeless-test.sh Resolved
Copilot AI review requested due to automatic review settings August 11, 2026 09:57
@dhh
dhh force-pushed the recover-modeless-monitors branch from 7e4160d to af70488 Compare August 11, 2026 09:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 6 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings August 11, 2026 10:10
@dhh
dhh force-pushed the recover-modeless-monitors branch from af70488 to dee81ac Compare August 11, 2026 10:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 6 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings August 11, 2026 10:25
@dhh
dhh force-pushed the recover-modeless-monitors branch from dee81ac to 5ea7867 Compare August 11, 2026 10:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 6 changed files in this pull request and generated no new comments.

Suppressed comments (1)

test/shell.d/monitor-modeless-test.sh:216

  • This assertion allows two additional reloads. Because the test sends exactly two echoed events, an implementation that starts one recovery loop per event can produce two reloads and still pass, so the anti-stacking behavior is not actually verified. Please synchronize the fake reload/worker startup and assert that the event burst creates no additional recovery worker (or no additional immediate reload).
(( after - before <= 2 )) ||

@dhh
dhh force-pushed the recover-modeless-monitors branch from 5ea7867 to 4d0a4da Compare August 11, 2026 10:45
Copilot AI review requested due to automatic review settings August 11, 2026 10:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 6 changed files in this pull request and generated no new comments.

Suppressed comments (1)

test/shell.d/monitor-modeless-test.sh:217

  • This assertion still passes if both injected configreloaded events start separate loops and each immediately reloads once—the exact regression the test describes. Because the active loop is in its three-second sleep and this check waits only two seconds, require zero new reloads here so the test actually verifies lock-based deduplication.
(( $(reloads) - before <= 2 )) ||
  fail "an echoed configreloaded does not stack a second recovery loop" "$before -> $(reloads)"

A monitor powered off when the machine boots — a smart strip cutting AC, the PC
coming back on its own — still answers DDC, but with a partial EDID that carries
no video modes. Hyprland takes the connector as present and brings the monitor
up at 0x0. Powering it on afterwards changes nothing: the connector never
dropped at DRM level, so no hotplug fires, nothing re-reads the EDID, and the
screen stays black until a reboot.

Only a reload re-reads it. Forcing a DRM re-probe would work too but needs root,
and the kernel's cached mode list stays empty without one, so there is nothing
cheaper to poll: the reload is both the fix and the only way to learn whether it
was needed. Poll only while a monitor is in that state, back off from three
seconds to a minute, and stop as soon as one reports a mode — the machine can
sit black all night, and powering the monitor on fires no event to stop on.

Nothing will ask again if this loop gives up, so an unreadable answer is not
taken for a healthy monitor. It is also not waited on forever: a compositor that
stays silent has gone, and with it the session and any reason to keep asking.

Reloading on our own schedule means minding the reload guard, which exists to
keep Hyprland out of package-owned config mid-transaction, and which only
disables the automatic reloads. The guard can now be asked, and recovery holds
off while a transaction is in flight.

A reload lands a monitor at 0x0 the same way a boot does, so configreloaded is
watched alongside the hotplug events. The recovery's own reload comes back
through it, and a lock keeps that from stacking a second loop. Contention waits
rather than drops: a trigger arriving while a loop is exiting is the last one
that will come, and one arriving while a loop is running is answered by its next
pass anyway.

Mirrors are dropped from `hyprctl monitors`, so the check asks for all of them
and filters the disabled ones itself. Monitors turned off on purpose sit at 0x0
too, and re-applying config would fight the user over those.

The existing poll here recovers internal panels on docked laptops and never runs
on a desktop, which is where this happens.

Reported in #6668.

Co-Authored-By: Claude Opus 5 <[email protected]>
@dhh
dhh force-pushed the recover-modeless-monitors branch from 4d0a4da to 977be7a Compare August 11, 2026 11:11
Copilot AI review requested due to automatic review settings August 11, 2026 11:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 6 changed files in this pull request and generated no new comments.

@dhh
dhh merged commit 3b08a85 into quattro Aug 11, 2026
4 checks passed
@dhh
dhh deleted the recover-modeless-monitors branch August 11, 2026 11:26
nick1udwig pushed a commit to nick1udwig/omarchy that referenced this pull request Sep 9, 2026
A monitor powered off when the machine boots — a smart strip cutting AC, the PC
coming back on its own — still answers DDC, but with a partial EDID that carries
no video modes. Hyprland takes the connector as present and brings the monitor
up at 0x0. Powering it on afterwards changes nothing: the connector never
dropped at DRM level, so no hotplug fires, nothing re-reads the EDID, and the
screen stays black until a reboot.

Only a reload re-reads it. Forcing a DRM re-probe would work too but needs root,
and the kernel's cached mode list stays empty without one, so there is nothing
cheaper to poll: the reload is both the fix and the only way to learn whether it
was needed. Poll only while a monitor is in that state, back off from three
seconds to a minute, and stop as soon as one reports a mode — the machine can
sit black all night, and powering the monitor on fires no event to stop on.

Nothing will ask again if this loop gives up, so an unreadable answer is not
taken for a healthy monitor. It is also not waited on forever: a compositor that
stays silent has gone, and with it the session and any reason to keep asking.

Reloading on our own schedule means minding the reload guard, which exists to
keep Hyprland out of package-owned config mid-transaction, and which only
disables the automatic reloads. The guard can now be asked, and recovery holds
off while a transaction is in flight.

A reload lands a monitor at 0x0 the same way a boot does, so configreloaded is
watched alongside the hotplug events. The recovery's own reload comes back
through it, and a lock keeps that from stacking a second loop. Contention waits
rather than drops: a trigger arriving while a loop is exiting is the last one
that will come, and one arriving while a loop is running is answered by its next
pass anyway.

Mirrors are dropped from `hyprctl monitors`, so the check asks for all of them
and filters the disabled ones itself. Monitors turned off on purpose sit at 0x0
too, and re-applying config would fight the user over those.

The existing poll here recovers internal panels on docked laptops and never runs
on a desktop, which is where this happens.

Reported in omacom#6668.

Co-authored-by: Claude Opus 5 <[email protected]>
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.

Monitors stay black (0x0) when PC boots with monitors off — never recover on wake

2 participants