Repository navigation
Leave an auto-scaled internal panel alone in clamshell recovery - #7581
Conversation
There was a problem hiding this comment.
Pull request overview
Prevents clamshell recovery from overriding Hyprland’s resolved scale when the internal panel uses "auto".
Changes:
- Leaves enabled auto-scaled panels unchanged.
- Adds regression coverage for global and explicit
"auto"scales.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
bin/omarchy-hyprland-monitor-clamshell |
Skips numeric scale synchronization for enabled auto-scaled panels. |
test/shell.d/monitor-clamshell-scale-test.sh |
Updates and expands auto-scale regression tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
With the default scale = "auto", sync_internal_scale read the config, rejected "auto" as non-numeric, fell back to the hardcoded default 2, and force-applied it whenever the compositor's auto resolution differed. Since the script runs from omarchy-system-wake after every idle cycle, the panel flapped between 2 and auto's own value (1.5666667 on a 198 DPI panel) on every wake/reload pair. A config without a usable number -- "auto", or an expression only Hyprland's Lua can evaluate -- delegates the scale to the compositor: whatever it resolved for the enabled panel is the configured scale, so there is nothing to correct. Recovery of a disabled panel is unchanged and still re-enables it with the remembered scale, falling back to the historical default 2. Fixes omacom#7265. Also the scale-revert half of omacom#7301. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01L4Z6GimYhR1Kpsir24VAPF
ab6efdd to
b14c7d7
Compare
|
Verified against the source and on hardware-equivalent VMs. This is the right fix, and it is the one #6909 needs. What the guard actually changes. Recovery paths are intact. I walked every caller of The new tests earn their place. Reverting The second of those is the shipped config's exact shape, which is the one that matters for the reports. The negative On the residual you named. A Scope, against the other open work. This covers configs where the internal panel has no numeric scale to find — the shipped default and anything else resolving to Reviewed independently by codex at xhigh, which found no defects. Where it agrees with the above it is agreement rather than a second discovery: its sandbox restricts writes but not reads, so its independence is not guaranteed. It could not run the test file; that ran on the VM instead. Nothing to change here. Waiting on a maintainer. |
…om#7581) With the default scale = "auto", sync_internal_scale read the config, rejected "auto" as non-numeric, fell back to the hardcoded default 2, and force-applied it whenever the compositor's auto resolution differed. Since the script runs from omarchy-system-wake after every idle cycle, the panel flapped between 2 and auto's own value (1.5666667 on a 198 DPI panel) on every wake/reload pair. A config without a usable number -- "auto", or an expression only Hyprland's Lua can evaluate -- delegates the scale to the compositor: whatever it resolved for the enabled panel is the configured scale, so there is nothing to correct. Recovery of a disabled panel is unchanged and still re-enables it with the remembered scale, falling back to the historical default 2. Fixes omacom#7265. Also the scale-revert half of omacom#7301. Claude-Session: https://claude.ai/code/session_01L4Z6GimYhR1Kpsir24VAPF Co-authored-by: Claude Fable 5 <[email protected]>
With the default scale = "auto", sync_internal_scale read the config, rejected "auto" as non-numeric, fell back to the hardcoded default 2, and force-applied it whenever the compositor's auto resolution differed. Since the script runs from omarchy-system-wake after every idle cycle, the panel flapped between 2 and auto's own value (1.5666667 on a 198 DPI panel) on every wake/reload pair. A config without a usable number -- "auto", or an expression only Hyprland's Lua can evaluate -- delegates the scale to the compositor: whatever it resolved for the enabled panel is the configured scale, so there is nothing to correct. Recovery of a disabled panel is unchanged and still re-enables it with the remembered scale, falling back to the historical default 2. Fixes #7265. Also the scale-revert half of #7301. Claude-Session: https://claude.ai/code/session_01L4Z6GimYhR1Kpsir24VAPF Co-authored-by: Claude Fable 5 <[email protected]> (cherry picked from commit b636164)
…om#7581) With the default scale = "auto", sync_internal_scale read the config, rejected "auto" as non-numeric, fell back to the hardcoded default 2, and force-applied it whenever the compositor's auto resolution differed. Since the script runs from omarchy-system-wake after every idle cycle, the panel flapped between 2 and auto's own value (1.5666667 on a 198 DPI panel) on every wake/reload pair. A config without a usable number -- "auto", or an expression only Hyprland's Lua can evaluate -- delegates the scale to the compositor: whatever it resolved for the enabled panel is the configured scale, so there is nothing to correct. Recovery of a disabled panel is unchanged and still re-enables it with the remembered scale, falling back to the historical default 2. Fixes omacom#7265. Also the scale-revert half of omacom#7301. Claude-Session: https://claude.ai/code/session_01L4Z6GimYhR1Kpsir24VAPF Co-authored-by: Claude Fable 5 <[email protected]>
Symptom
With the stock
monitors.lua(omarchy_monitor_scale = "auto"), the internal panel's scale flaps: every idle-wake it jumps to 2, every config reload it returns to whatever Hyprland's auto actually resolves (1.5666667 on my 2256x1504 @ 198 DPI panel, 1.5 on the reporter's 143 DPI panel in #7265). #7301 is the same loop seen from the screensaver side: dismissing the screensaver runsomarchy-system-wake, which snaps the scale back to 2.Root cause
omarchy-hyprland-monitor-clamshellruns fromomarchy-system-wakeafter every idle cycle. Itssync_internal_scalereads the configured scale, and for"auto":valid_scaleaccepts only numbers, soautois rejected,$SCALE_STATEfallback usually doesn't exist (it is only written when clamshell disables the panel),read_monitor_scalelands on the hardcoded fallbackecho 2,sync_internal_scalesees 2 != auto's resolution and force-applies 2.Deterministic repro on a live system with
scale = "auto":For what it's worth, the EDID-timing guess in #7265 doesn't reproduce: DPMS off/on cycles and a full
monitor eDP-1, disable→ re-enable cycle all keep auto's value stable. Only this script flips it.Fix
A config without a usable number — the default
"auto", or an expression only Hyprland's Lua can evaluate (scale = 3 / 2) — delegates the scale to the compositor: whatever it resolved for the enabled panel is the configured scale, sosync_internal_scalenow leaves it alone instead of substituting a number. The guard testsvalid_scaleon the configured value rather than special-casing the"auto"string, so expression scales stop flapping too, and the configured scale is read once per sync instead of twice (read_monitor_scaleaccepts the already-read value).Recovery of a disabled panel is unchanged: it still re-enables with the remembered scale (falling back to the historical default 2), and clamshell disable still records the active scale first — so the remembered value under auto is auto's own resolution, not the fallback.
This deliberately flips one existing assertion: the previous test required auto's resolution to be "corrected" to 2 (
clamshell recovery ignores transient auto scale). That assumption — that auto's resolution is transient noise and 2 is the real value — is precisely what #7265/#7301 report as a bug, so the test now asserts the panel is left alone.Tests
monitor-clamshell-scale-test.shgrows from 20 to 25 cases:scale = "auto"on the internal rule, and an expression scale (each fails against the unpatched script),echo 2fallback.All 25 pass;
./test/allshows no new failures against the baseline on my machine.Known bounded residual: if
hyprctl monitorsis transiently unreadable right after the lid-open reload, sync can still pin a number over auto until the next reload; the pre-existing code had the same window with a worse outcome, so it is left out of scope here.Live verification: with the patch, running the script under
scale = "auto"no longer changes the active scale; idle-wake cycles keep 1.5666667.Fixes #7265. Fixes the scale-revert half of #7301 (the "sub-1080p should default to 1x" suggestion there is a separate question).
🤖 Generated with Claude Code