Skip to content

fix(monitor): detect stranded outputs with no active scanout in omarchy-hyprland-monitor-modeless - #9110

Open
harshithnadig wants to merge 1 commit into
omacom:quattrofrom
harshithnadig:fix/monitor-modeless-scanout-check
Open

harshithnadig wants to merge 1 commit into
omacom:quattrofrom
harshithnadig:fix/monitor-modeless-scanout-check

Conversation

@harshithnadig

Copy link
Copy Markdown

Problem

In #9078, omarchy-hyprland-monitor-modeless only checks if .width == 0 or .height == 0.

When an external output drops link during an atomic commit or loses its CRTC, it reports a valid mode in hyprctl monitors all -j but is absent from actively scanned-out displays in hyprctl monitors -j. Because the query returned 1 ("recovered"), the recovery loop in omarchy-hyprland-monitor-watch exited immediately, leaving the monitor dark indefinitely.

Solution

Compare actively scanned-out outputs against hyprctl monitors all to detect enabled non-mirrored outputs that have dropped scanout alongside 0x0 modes.

Fixes #9078

…hy-hyprland-monitor-modeless

'omarchy-hyprland-monitor-modeless' only checked whether an enabled monitor
had .width == 0 or .height == 0. When an output drops link during an atomic
commit (or loses its CRTC after DPMS off), it retains a valid mode in
'hyprctl monitors all' but is unassigned and absent from active scanout
('hyprctl monitors'), causing the recovery loop in 'monitor-watch' to abort
prematurely and leave the screen black.

Compare active scanout outputs with all connected outputs to detect
unassigned/stranded enabled monitors alongside 0x0 mode monitors.

Fixes omacom#9078
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for picking up #9078. I reviewed this at 64cc9f5 and ran the monitor tests on a disposable Omarchy worker (Hyprland 0.56.2). As it stands, the new check can't match real hyprctl output, and it breaks the existing tests. I haven't pushed anything, because the fix needs evidence that only the affected hardware can provide.

The new clause never matches. Its third branch requires .mirrorOf == "" or .mirrorOf == null. Hyprland writes "none" for a monitor that isn't a mirror (src/debug/HyprCtl.cpp at v0.56.2: m->m_mirrorOf ? ... : "none"), and the worker's Virtual-1 reported exactly that. On the worker, I gave this head a stranded HDMI-A-2 in the shape Hyprland actually emits: enabled, a valid mode, mirrorOf: "none", present in monitors all and missing from monitors. It exited 1 ("recovered"). The same input with mirrorOf: "" exits 0. So the check only fires on a value Hyprland never produces, and for #9078 nothing changes.

Fixing the comparison probably isn't enough. Hyprland's monitor tracker (src/state/MonitorState.cpp) puts every enabled, non-mirror monitor back into the plain monitors list on each layout change. "Enabled, not a mirror, absent from monitors" is therefore at most a passing state. An output that lost its CRTC while Hyprland still thinks it's enabled most likely still appears in plain monitors. Neither #9078 nor #8863 includes hyprctl monitors -j captured while the screen was dark, and a worker can't reproduce a link drop. A detection signal for this needs that capture from a machine that hits the bug.

The existing tests fail at this head. They pass on quattro:

  • test/shell.d/monitor-modeless-test.sh: the fake hyprctl answers only monitors all -j. The new plain monitors -j query gets empty output, --argjson rejects it, and every case exits 2. The first assertion fails with "expected exit 0, got 2".
  • test/shell.d/monitor-recovery-test.sh: it exits 1 after 8 passes. Its grep -F '.disabled != true and (.width == 0 or .height == 0)' assertion no longer matches the reformatted predicate.

Even with working detection, a reload may not recover these outputs. omarchy-hyprland-monitor-watch responds to a modeless result with hyprctl reload, backing off to every 60 seconds. #12481 and #13073 report that a reload can't recover an output stuck on a failed atomic modeset. #12857 (open, same file) narrows the helper so it stops reloading in that case. Widening detection to CRTC-stranded outputs could leave the machine reloading all night without lighting the screen. Which way the helper should go is a question for the maintainer.

What would move this forward: hyprctl monitors -j and hyprctl monitors all -j captured while a monitor is stranded, a predicate based on what that capture shows, the two tests updated to cover it, and a remedy that actually recovers the output.

Who checked it: this review is Claude Opus 5.5 alone. The configured second opinion, Codex Medium, didn't run: it answered a ping, but today's review allowance was used up. Nothing here has been checked by a second model. This now waits on you, and on the maintainer's call between this approach and #12857.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omarchy-hyprland-monitor-modeless tests the wrong condition, so an output that is dark but has a valid mode never gets recovered

2 participants