Repository navigation
Conversation
Losing the last enabled monitor makes Hyprland bring up a headless output named FALLBACK. It reports disabled:false under a name no internal-panel pattern matches, so omarchy-hyprland-monitor-external-active answered yes to the very display whose disappearance created it. That answer is what every recovery path reads, so unplugging an external monitor while the laptop panel was disabled -- by SUPER + CTRL + Delete or by clamshell -- left the machine with no screen and nothing willing to re-enable one: recover() in monitor-internal returned early, enable_internal() in the clamshell sync returned early, and the "Can't disable the only active display" guard stopped protecting anything. Ask a DRM connector instead. omarchy-hyprland-monitor-physical lists the enabled monitors that have one, so neither the fallback nor a `hyprctl output create` headless can stand in for a display. An unreadable DRM tree reports nothing rather than everything: re-enabling a panel that did not need it costs a flicker, the opposite costs the only screen.
The reconciliation poll only ran while an external monitor was active, so it stopped at the very moment the panel needed re-enabling, leaving the three fixed retries in sync_clamshell_after_monitor_change as the last word. A resume can consume all three while Hyprland is still reconfiguring its monitors, and then nothing asks again. Run the poll while a flag still holds the panel off as well as while docked. Both flags clear once the panel is back, so it still stops on its own. Recovery also reports itself now: a panel the user switched off coming back by itself is the one state change nothing else accounts for. The notification sits past both guards, so it fires on the transition and not on every poll.
Member
|
We definitely have to solve this problem as it's described, but I do have concerns about the drawbacks. I'm wondering if there isn't another way to recover the laptop panel in hyprland. Maybe headless is a more controlled setting so the signal is stronger whether or not to start the laptop panel back up again after loss of externals. |
4 of 5 tasks
Author
|
Agreed. Keying on the fallback output is the narrower signal, and it leaves outputs created with #10586 already does exactly that for #10584 / #10935 and predates this PR, so I'm closing this in favour of it and adding my data points there. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
Disable the laptop panel (
SUPER + CTRL + Delete, or clamshell), then lose the external monitor — unplug the cable, or let a resume drop it — and the machine is left with no screen at all. Pressing the shortcut again usually does not bring it back; a reboot does.Why
When the last enabled monitor goes away, Hyprland brings up a headless output named
FALLBACK(CFallbackStateKeeper,src/state/FallbackState.cpp; present in 0.56.2). It reportsdisabled: falseunder a name no internal-panel pattern matches, which is exactly the shapeomarchy-hyprland-monitor-external-activelooks for:So the helper answers "yes, an external display is active" about the very output whose disappearance created it. Every recovery path reads that answer, and they all stand down:
omarchy-hyprland-monitor-internalrecover()external-active && return 0— never clears the flagomarchy-hyprland-monitor-clamshellenable_internal()[[ -f $MANUAL_DISABLE_FLAG ]] && external-active && return 0omarchy-hyprland-monitor-watchsync_poll_stateoff()'s "Can't disable the only active display" guardReproduced in a nested Hyprland — disable the internal output, remove the external one:
It also happens in the wild. On my machine
xdg-desktop-portal-hyprlandenumeratedFALLBACKtwice in one session, and one of them is the resume path rather than an unplug:The panel itself is fine: dropping the
disablerule and reloading recovers it every time. Nothing was dropping the rule.The fix
1. Ask a DRM connector, not a name. New
omarchy-hyprland-monitor-physicallists the enabled monitors backed by a real connector under/sys/class/drm, andexternal-activeis now defined in terms of it. A fallback output — or one fromhyprctl output create— cannot stand in for a display. Every caller is fixed by that one change, theoff()guard included.An unreadable or empty DRM tree reports nothing rather than everything. Failing that way re-enables a panel that did not need it; failing the other way leaves the machine with no screen.
2. Keep asking. The reconciliation poll only ran while an external monitor was active, so it stopped at the moment the panel needed re-enabling, leaving the three fixed retries in
sync_clamshell_after_monitor_changeas the last word — and a resume can consume all three while Hyprland is still reconfiguring. It now also runs while a flag holds the panel off, and still stops on its own once the flags clear.recover()sends a notification when it re-enables a panel by itself, past both guards so it fires on the transition and not on every poll.Trade-off worth flagging
Anyone driving a headless output with no physical display attached can no longer disable the internal panel while that output is the only one, and the recovery would re-enable it. That follows from treating a DRM connector as the definition of a display; making an exception for user-created headless outputs would put the two safeguards in conflict.
Testing
./test/cligreen;./test/shellhas the same 6 pre-existing failures asquattrodoes on this machine (omarchy-pkgscheckout absent, andlocate-test.shchokes on the__pycache__the suite itself writes intobin/), none in the changed area.test/shell.d/monitor-physical-test.shcovers the fallback output, user-created headless outputs, mirrors, monitors disabled on purpose, and an unreadable DRM tree.test/shell.d/monitor-recovery-test.shnow exercises the poll condition functionally instead of asserting the old helper's jq text.external-activeturns the new test red, and dropping the flag arm of the poll condition turns the recovery test red.🤖 Generated with Claude Code
https://claude.ai/code/session_0152hkn3EdSGLSwnWBF22xeZ