Repository navigation
fix(monitor): fix display mirroring recovery and UI state - #6457
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The helper now asks `hyprctl monitors all -j`, so the test that pinned it to plain `monitors` failed. A mirrored external is absent from plain `monitors`, which reads as a disconnect and hands the mirror toggle to recovery. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Piping the first mirroring monitor into the branch fed jq's test() a null whenever no output mirrored, and jq aborts there rather than falling back to "". The panel reads this output by line, so the missing line shifted the focused monitor, the scale, and the display list up one, and left mirroring reading as on whenever the external display had focus. Select first and branch inside the pipeline, so the branch only ever sees a monitor and the empty case falls to "" as the lines around it do. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Nothing exercised omarchy-monitor-state, so both the mirror direction it reported and the jq that reported it went unguarded. The panel reads the output by line index, where a helper dying mid-script costs a line and shifts every field below it into the wrong property without failing. Assert the line count alongside the fields, over extended, mirrored both directions, and clamshelled displays. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (1)
test/shell.d/monitor-state-test.sh:53
- The repository shell style requires variables to remain unquoted inside
[[ ]]; only string literals are quoted. Use$expectedunquoted here to follow that convention.
[[ ${state_lines[index]-} == "$expected" ]] ||
nick1udwig
pushed a commit
to nick1udwig/omarchy
that referenced
this pull request
Sep 9, 2026
* fix(monitor): prevent mirror toggle deletion during recovery and fix UI state * Assert the external monitor helper counts mirrors as active The helper now asks `hyprctl monitors all -j`, so the test that pinned it to plain `monitors` failed. A mirrored external is absent from plain `monitors`, which reads as a disconnect and hands the mirror toggle to recovery. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * Keep the mirror state line when nothing is mirrored Piping the first mirroring monitor into the branch fed jq's test() a null whenever no output mirrored, and jq aborts there rather than falling back to "". The panel reads this output by line, so the missing line shifted the focused monitor, the scale, and the display list up one, and left mirroring reading as on whenever the external display had focus. Select first and branch inside the pipeline, so the branch only ever sees a monitor and the empty case falls to "" as the lines around it do. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * Cover the monitor panel state the shell reads by line Nothing exercised omarchy-monitor-state, so both the mirror direction it reported and the jq that reported it went unguarded. The panel reads the output by line index, where a helper dying mid-script costs a line and shifts every field below it into the wrong property without failing. Assert the line count alongside the fields, over extended, mirrored both directions, and clamshelled displays. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: David Heinemeier Hansson <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.
Why
In Omarchy 4 (
quattro), toggling display mirroring on a laptop (viaomarchy-hyprland-monitor-internal-mirror on,SUPER + CTRL + ALT + Delete, or the shell display panel) turned mirroring on for a split second before immediately reverting back to extended display mode. Additionally, theomarchy-shelldisplay panel always rendered the Mirroring toggle as OFF.Root Cause Details
Auto-Recovery Race Condition:
On Intel GPUs (and Aquamarine DRM), setting a display to mirror mode merges CRTC rendering streams in Hyprland, causing the mirrored display to be omitted from the standard
hyprctl monitors -joutput (it is only returned byhyprctl monitors all -j).This caused
omarchy-hyprland-monitor-external-activeto return exit code 4 (false) while mirroring was active. Whenhyprctl reloadfired, theomarchy-hyprland-monitor-watchdaemon invokedomarchy-hyprland-monitor-clamshell->internal-mirror recover, which falsely treated the external monitor as disconnected and immediately deleted theinternal-monitor-mirror.luatoggle flag.UI State Resolution Mismatch:
In
bin/omarchy-monitor-state, line 15 specifically checked.mirrorOfon the internal display (eDP-1). When the external monitor (HDMI-A-1) mirrored the internal display,.mirrorOfwas populated on the external monitor instead of the internal display, causingomarchy-monitor-stateto return an empty string andPanel.qmlto evaluatemirrorEnabled = false.What
Two targeted fixes:
bin/omarchy-hyprland-monitor-external-active: Switchedhyprctl monitors -jtohyprctl monitors all -jso mirrored external monitors are correctly recognized as active, preventing the false disconnect recovery loop.bin/omarchy-monitor-state: Updated the.mirrorOfjq extraction to evaluate any active mirror target regardless of mirror direction, returning the external display name when mirroring is active soomarchy-shellrendersmirrorEnabled = true.Verification
quattrobranch) with an external HDMI display.omarchy-hyprland-monitor-internal-mirror togglestays active continuously without being deleted by recovery.omarchy-monitor-statecorrectly reports the active mirror output toomarchy-shell../test/cliand./test/shell) with clean passes.