Repository navigation
Preserve monitor layout when re-enabling a display - #16147
Conversation
Only update the disabled field when enabling an output from the Display panel. Let the existing named monitor rule retain its mode, position, and scale, and cover command generation, output escaping, action launch, and the last-display guard.
[Medium impact] This focused change appears safe to merge. SummaryRe-enabling a display now changes only
Review checks were static; no tests or compositor checks were run during this review. Reviews (1) · Last reviewed commit: "Preserve monitor layout when re-enabling..." · Reviewed by Greptile |
|
Reviewed at 5f2b560. Nothing found to change, and nothing was pushed. Reproduction, on a disposable Omarchy worker running Hyprland 0.56.2. Using a headless output with a named rule ( Tests, run on the same worker with the PR linked into the running shell: Second opinion (Codex Medium): it found no defect and judged the change proportionate. It checked Hyprland 0.56.2's source and confirmed that Related: #7036 rewrites the same This is waiting on the maintainer. |
Summary
Fixes #15986 by preserving an existing output rule when a display is re-enabled from the Display panel.
Cause and fix
toggleDisplay()disables an output withdisabled = true, but its enable command also suppliesmode = "preferred",position = "auto", andscale = "auto".hl.monitor()updates the existing rule, so these values overwrite a user's monitor layout. A portrait output configured on the left can return on the right at another scale and mode.Change the enable command to supply only
outputanddisabled = false. The existing output rule retains its remaining fields. The disable command, output-name escaping, and last-enabled-display guard keep their existing behavior.This is one command replacement with an explanatory comment, plus focused regression coverage. No config parsing, saved-layout cache, dependency, or migration is introduced.
Validation
Reproduced on Radeon 8060S using an AMD-accelerated, sandboxed nested Hyprland 0.56.2 compositor. The probe executes the actual panel function in a minimal JavaScript host and applies the generated commands to the compositor, using two headless test outputs for stable geometry.
(0, 60)(1920, 0)(0, 60)1.2521.251200×800 @ 60 Hz1920×1080 @ 60 Hz1200×800 @ 60 Hz1024×768 @ 75 Hz1920×1080 @ 60 Hz1024×768 @ 75 HzThree native scenarios each run three toggle cycles. Every fixed cycle preserves the named output's position, mode dimensions, refresh, scale, transform, and enabled state; the anchor output is unchanged. Configuration errors are checked and screenshots are inspected.
The new regression fails against the original panel, then passes with the patch. 60 focused automated checks pass: 12 toggle checks, 21 monitor-model checks, 5 monitor-state checks, 8 output-name checks, and 14 scaling checks. Bash syntax and whitespace checks also pass.
Validation boundary
The reported configuration names each output explicitly. An additional custom wildcard-rule control loses inherited mode/scale values after toggling on both original and patched sources, because the output-specific disable rule does not retain them. This patch addresses the existing named-rule overwrite in #15986; that inherited-rule behavior remains unresolved.
The native comparison exercises compositor rule updates and rendering. Physical DisplayPort hotplug, suspend, and a complete Quickshell panel-click flow were not tested. Related #7036 changes the same function for internal-panel ownership and should be coordinated if it lands first.