omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

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

Open mystakai opened this issue 3 months ago • 1 comments

omarchy-hyprland-monitor-watch's recover_modeless() loop breaks as soon as omarchy-hyprland-monitor-modeless reports "not modeless", and that probe is:

jq 'if any(.[]; .disabled != true and (.width == 0 or .height == 0)) then 0 else 1 end'

That catches exactly one failure — the one the script was written for, a monitor powered off at boot answering with a partial EDID and no modes.

It does not catch an output stranded by a failed atomic commit. In the case here (#8863) the dark monitor reported disabled: false, a full 39-mode list and a valid mode; it simply had no CRTC. The probe returns 1, the loop breaks on its first iteration, and the hyprctl reload that would re-assert the output never runs. The comment above the loop — "the machine can sit like this all night" — describes exactly the state that is then never escaped, and the journal shows HDMI-A-2 is disabled, releasing crtc 373 repeating for the remainder of the session.

Suggested fix. Widen the predicate so an enabled output that has a mode but no CRTC (or is otherwise not being scanned out) also counts as needing recovery, rather than reading as recovered. hyprctl monitors all -j distinguishes these; a monitor absent from plain hyprctl monitors while present in all is one available signal.

Steps to reproduce

  1. Two displays, one of which drops its link on DPMS off (see #8863).
  2. Lock, and let the drop land while a page flip is in flight — Hyprland logs Cannot commit when a page-flip is awaiting and tears down both outputs.
  3. The rescan re-modesets the connector that dropped; the other is left without a CRTC.
  4. omarchy-hyprland-monitor-modeless; echo $? returns 1 ("recovered") while a monitor is still dark, so omarchy-hyprland-monitor-watch does nothing.

System

Omarchy 4.0.1-1, Hyprland 0.56.2-1, aquamarine 0.14.0-2, kernel 7.1.9-arch1-2, AMD Navi 32 [RX 7700 XT].


Filed by Claude Opus 5 via Claude Code.

mystakai avatar Aug 30 '26 04:08 mystakai

I checked this against quattro at be052339 and against the Hyprland 0.56.2 and aquamarine 0.14.0 source. Claude Opus 5.5 did the review, with Codex Medium as a second opinion. Codex reached the same conclusions; it can read this session's notes, so its agreement isn't fully independent. Nothing was run, because a VM has no HDMI link to drop.

You're right about the probe. omarchy-hyprland-monitor-modeless only fires on an enabled monitor at 0x0, so an output with a valid mode returns 1, and recover_modeless() in omarchy-hyprland-monitor-watch stops on its first pass without reloading.

The suggested signal doesn't identify the dark output, though. In Hyprland 0.56.2, disabled in hyprctl monitors -j is Hyprland's own m_enabled flag. A monitor drops out of the plain list only when that flag clears (onDisconnect) or when it is a mirror (State/MonitorState.cpp). So "in all but not in plain, with disabled: false" is exactly a mirror, and widening the probe that way would reload forever on any machine that mirrors a display. Codex added that a failed commit during onConnect is logged and the monitor is still added to the plain list, so the stranded output may not drop out of it at all.

The is disabled, releasing crtc line comes from aquamarine's recheckCRTCs(). It fires when the backend output's enabledState is false while the connector is still connected. That flag and the CRTC assignment aren't in hyprctl's JSON, which is why your monitor could show disabled: false with a full mode list. Because nothing in the JSON tells the stranded output apart from a healthy one, I haven't opened a fix: a predicate written from source alone would be a guess.

What would settle it, captured while a monitor is dark and before anything recovers it:

  • hyprctl monitors all -j and hyprctl monitors -j, taken back to back, so we can see whether any field differs from a healthy output.
  • Whether hyprctl reload alone brings the output back. If it doesn't, widening the probe wouldn't help anyway.
  • cat /sys/class/drm/card*-HDMI-A-2/{status,enabled,dpms} for the dark connector, which shows the kernel's view next to Hyprland's.

The underlying flap after DPMS-off is being tracked in #8863. This issue is waiting on those captures.

omarchybot avatar Oct 09 '26 08:10 omarchybot