Repository navigation
Require a mode before counting an external monitor as active - #12253
Maximilian-Maag wants to merge 4 commits into
Conversation
An external output unplugged with the dock can stay listed by Hyprland and still flagged enabled while reporting no mode at all -- the 0x0 state omarchy-hyprland-monitor-modeless already exists to detect. omarchy-hyprland-monitor-external-active tested only `disabled == false`, so it read that leftover as a live screen. The recover path in omarchy-hyprland-monitor-internal returns early while an external looks active, so the internal panel stayed disabled after undocking and the laptop came back to a black screen -- recoverable only by replugging the dock into another port. Require a mode, so a monitor counts as a screen only once it reports one. The other callers benefit from the same guard: clamshell no longer disables the internal panel against a dead external, and `internal off` no longer agrees to blank the only remaining screen. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Automated AI review
Verified: the new filter does what it targets. An external that Hyprland lists as enabled at 0x0 no longer counts as active, which makes
The last row is the subject of the second finding below. The code comment and PR description describe a trigger the Hyprland source does not produceIn Hyprland 0.56.2 and aquamarine, an output's mode list is filled only when the output is created and is never refreshed while it stays connected. A running external that is switched off at the wall or loses KVM signal therefore does not drop to 0x0: The stuck state this PR fixes needs the manual Impact: the new comment in Suggested change: describe the actual state in the comment, for example: an external created without a usable mode (such as a monitor answering with a partial EDID when it connects) stays listed and enabled at 0x0. Pre-existing: Hyprland's
|
With a 0x0 output no longer counted as an active external, a laptop that boots with its lid shut and its only external unpowered keeps the panel on and never starts the docked poll. When the monitor is switched on, the modeless recovery's reload gives it a mode, but no hotplug follows and configreloaded only ran recover_modeless, so the panel stayed enabled behind the closed lid. Run the clamshell sync and poll-state check on configreloaded too, as the hotplug events do. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-Authored-By: Codex Medium <[email protected]>
|
Reviewed and reproduced: the fix works, and I pushed one commit on top for a regression it introduced in the watcher. The bug is real. On a worker, with Pushed: f85df19, "Reconcile clamshell after a reload, when a 0x0 external gains its mode". Once a 0x0 output stops counting as active, a laptop that boots with its lid shut and its only external switched off keeps the panel on and never starts the docked poll in One thing for the author, not blocking: the new comments in Tests, on a worker built from the Omarchy ISO: Overlap: #13749 edits the same line of Second opinion: Codex Medium reviewed it in two rounds. In the first it independently traced the same watcher regression. Its other points were that the comments overstate the undock origin and that the new source grep makes the test exit on This waits on the maintainer. It is labelled |
[Medium impact] The changes affect laptop display recovery and clamshell synchronization. The PR still needs the previously reported fix that preserves mirroring across temporary mode loss. Findings
SummaryRequires positive
|
| # recover path in omarchy-hyprland-monitor-internal sees an active external and | ||
| # returns before re-enabling it. A monitor is only a screen once it reports a | ||
| # mode. | ||
| hyprctl monitors all -j | jq -e '.[] | select(.name | test("^(eDP|LVDS|DSI)-") | not) | select(.disabled == false) | select(.width > 0 and .height > 0)' >/dev/null 2>&1 |
There was a problem hiding this comment.
Temporary mode loss clears mirroring
If a mirrored external temporarily reports 0x0 while its mode is being recovered, this check reports that no external is active. Clamshell reconciliation then runs mirror recovery, which removes the saved mirror toggle. When the external regains its mode, the mirror setting is not restored, so a temporary loss permanently switches the session out of mirror mode.
Knowledge Base Used: Hyprland configuration and display control
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
The mode filter now sits beside omacom#13749's FALLBACK filter in omarchy-hyprland-monitor-external-active. The source greps this branch added to monitor-recovery-test.sh went with omacom#16334, so the 0x0 case is a behavioural check in quattro's stubbed-hyprctl style, and the fixtures carry a mode so the FALLBACK case still exercises its own filter. Co-Authored-By: Claude Opus 5.5 <[email protected]>
monitor-recovery-test.sh lost the source grep for this with omacom#16334, so the watcher's configreloaded arm is now checked by driving the watcher with a fake event stream in monitor-modeless-test.sh, which fails with the arm reverted. It waits for the four startup syncs before clearing the log, so a startup retry that runs late cannot pass for the reload's. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-Authored-By: Codex Medium <[email protected]>
|
This had stopped merging after #13749 and #16334 landed on Pushed:
Checked, on a worker built from the Omarchy ISO: Second opinion: Codex Medium and muse-wonder (pi, thinking high) reviewed the merge and the new test in two rounds. In the first round, both found the race that the startup wait now closes. In the second round, on 776901e, both found nothing wrong. Their independence from this review is not guaranteed. For the author: the description's Tests section still lists the cases dropped above. Updating it would help whoever reads it at merge time. Overlap: #16778 and #17115 also edit This is labelled |
The bug
Two helpers in this repo disagree about the same monitor, and the disagreement costs you every screen you have.
omarchy-hyprland-monitor-modelesstreats an enabled output with no mode as a black screen that needs recovering:omarchy-hyprland-monitor-external-activetreats that identical output as a live external screen:For an external at
disabled=false, 0x0, both return true at once. One half of the codebase is trying to rescue that monitor while the other half is citing it as proof a screen is already working.Why that strands the panel
omarchy-hyprland-monitor-external-activegates the internal panel's recovery in both paths that could restore it:So while a modeless external is counted as active, neither path re-enables the panel.
Reproducing it without any special hardware
This needs no dock.
omarchy-hyprland-monitor-modelessalready documents the trigger:Dock a laptop with the lid shut, so clamshell disables the internal panel. Now switch the external monitor off at the wall, or let it drop signal through a KVM.
0x0omarchy-hyprland-monitor-external-active→ trueomarchy-hyprland-monitor-internal recover→ returns earlyomarchy-hyprland-monitor-clamshell→ returns earlyInternal panel disabled, external showing nothing. Zero usable screens, and
omarchy-hyprland-monitor-watchpolls that path every 2s and returns early every time. The only way out is a blind reboot.The fix
Require a mode. A monitor counts as a screen only once it reports one — the same standard
omarchy-hyprland-monitor-modelessalready applies.Why here, rather than at the call sites
Every caller wants the same answer, and each is improved by the stricter one:
omarchy-hyprland-monitor-internal recover— the bug above; now recovers.omarchy-hyprland-monitor-internal off— no longer agrees to blank the only real screen on the strength of a dead external.omarchy-hyprland-monitor-clamshell— no longer disables the internal panel against a dead external, the same black screen reached via the lid switch.Tests
test/shell.d/monitor-recovery-test.shgains a decision table over the states the helper has to separate: a mode-reporting external, a mirror, an output left behind at0x0, a laptop alone, and an external disabled on purpose. It fails without the one-line change.Context
I hit this while chasing an undock black screen on a Dell WD22TB4. That machine turned out to have host firmware problems of its own — no Thunderbolt NHI,
ucsi_acpifailing to probe, so DP Alt Mode only ever negotiates at power-on — and I want to be explicit that none of the argument above rests on that hardware. The claim here is the contradiction between the two helpers, which is visible in the source and covered by the test.