Repository navigation
Conversation
|
Live verification for the two riskier choices in this PR, on real hardware (Omarchy 4.0.4-1, Hyprland 0.56.2, DP-1 1920x1080 at 0x0 scale 1, DP-2 same mode at 1920x0): Re-applied the already-active scale (1) through the patched script and compared hyprctl monitors -j before/after: mode, refreshRate, position and scale are all byte-identical afterwards (rate stays at the running 164.91701 Hz), and monitors.lua is untouched. So the rate-less mode = WxH is accepted and keeps the current rate instead of fighting float formatting — note monitors.lua pins 164.92 while Hyprland reports 164.91701, which is exactly the mismatch the old @-suffix carried back in. On preferred/auto as an alternative for the scaling path: that would change semantics, not just formatting. set_scale must never change the resolution (non-native modes, VMs), and mode = preferred would do exactly that as a side effect — which is why this keeps the exact WxH and only drops the rate suffix. |
Hyprland 0.56 reads a mode with no @Rate as a request for 60Hz and picks the mode closest to it, so every scale change dropped a high-refresh display to 60Hz until the next reload. On a worker at [email protected] the rate-less mode left it at 60.00Hz; with the rate restored it stays at 74.99Hz. A rate Hyprland reports with more precision than monitors.lua pins still resolves to the same mode, since Hyprland matches the closest one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
An explicit hl.monitor entry for the focused output took the per-output branch whatever its scale said, so an entry with scale = omarchy_monitor_scale (the layout in omacom#13062) matched no number, nothing was written, and the scale reverted on reload; before, the variable was updated. Only an entry with its own number or "auto" is rewritten in place now, and one that reads the variable falls through to updating it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The greedy .*scale = reached past the closing }) into a trailing comment, so a line like scale = omarchy_monitor_scale }) -- was scale = 1 rewrote the comment, took the per-output branch, and never updated the variable the entry actually reads. Stopping at the first } keeps the match to the table's own scale field. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-Authored-By: Codex Medium <[email protected]>
An entry with scale = 3 / 2 matched its leading 3, so choosing 2 wrote scale = 2 / 2 and the output came back at 1 on reload. The value must now end at a comma or the closing brace; anything else falls through as before this change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-Authored-By: Codex Medium <[email protected]>
|
|
Reviewed and tested on an Omarchy worker running Hyprland 0.56.2. The position fix holds: with two outputs side by side, a scale change on Three things were wrong, and I pushed a commit to this branch for each:
What ran on the worker: #13605 is a draft fixing the same persistence bug. Its per-output branch is chosen by output name alone, so it has the Codex Medium gave the second opinion over three rounds. It found the trailing-comment and expression cases, which are fixed above, and its last round, on |
|
Two small things:
Also, #13605 persists the scale to the focused output rule for the same #13229, so a maintainer will need to pick one persistence path. |
Two per-output layouts still lost the chosen scale on reload: an entry
whose table contains a nested table (reserved_area = { top = 24 }) ended
the match at the first }, and ;-separated fields failed the [,}] value
terminator. In both cases the scale was not written, and the fallback
could move the shared omarchy_monitor_scale instead.
Replace the entry match with an awk pass that blanks comments while
keeping offsets, counts braces so the entry's own scale is found, accepts
, and ; as field separators, and rewrites only a whole scalar value
("auto" or a number). Expressions and variable-reading entries fall
through to the existing paths unchanged.
Adds nested-table, semicolon and block-comment cases to
test/shell.d/monitor-scaling-test.sh (24 cases).
|
Thanks for the review.
Also pushed a fix for the two remaining greptile findings on the persistence path: an explicit entry with a nested table ( |
|
Re-tested at f177c9d on an Omarchy worker running Hyprland 0.56.2, with two outputs side by side.
One thing is left, and it is size rather than a bug. The scanner this commit adds is about 90 lines of awk that tokenise Lua to find one key, and it is still not a full parser: it reads one line at a time, so an entry commented out inside a multi-line Codex Medium gave the second opinion on this commit. It found the new tests are real, not vacuous, and reached the same view on size: it called the awk excessive for these two cases, with the clamshell This waits on you for the smaller match. After that, which of this and #13605 lands is the maintainer's call; this one is older and also fixes the position bug. |
Replace the Lua-like awk scanner with a smaller sed rewrite for single-line monitor rules and whole scalar values. Preserve the nested-table and semicolon regression cases, skip multi-line block comments, and accept single-quoted outputs and automatic scales. Add regression coverage for commented rules, single quotes, misleading comment fields, and quoted scale expressions. All 28 scaling checks and all nine monitor-related suites pass.
|
Thanks for the re-test and the suggestion. Pushed f02eb58 to replace the AWK scanner with a smaller The existing nested Also covered the two gaps you identified: rules inside multi-line Validation for this commit:
|
Treat comments as whitespace around scale fields and keep live rules before and after block comments reachable. Use a compact Perl match that skips complete comments and strings, preserving their original contents and replacing only whole scalar scales. Add eight regression cases for the reported boundaries, adjacent comments, long comments, quoted comment markers, and expressions containing comments. All 36 scaling checks and all nine monitor-related suites pass.
|
Confirmed both new findings and pushed 3ee4918 to address comments around The previous simplification missed three cases that worked before it; code after a closing block-comment marker was already unsupported. All four now have regression coverage.
The line-based Added eight regression cases. The new persistence fixtures compare the complete saved config, checking that only the intended scale changes and that comments, other outputs, and the shared default are preserved. Validation:
|
The explicit-entry rewrite ran perl -i on every scale change, so a config with nothing to persist into was still rewritten. Hyprland reloads on any write to its config, and the reload reapplies monitors.lua, undoing the scale that had just been set: on a worker, scaling an output whose entry reads `scale = 1 * 1` left it at 1 instead of 1.25. Look for a match first and write only when there is one. The test compares inode and mtime, since an inode alone can be reused by a rewrite, and checks the scale was still applied. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-Authored-By: Codex Medium <[email protected]>
Backtracking could end a long string or comment at a later closing bracket, or end a line comment early. Scaling eDP-1 then rewrote DP-2's scale when both entries carried a `--[[ ]]` comment or a `[[...]]` string, and a `scale = 1.25` inside a line comment in a multi-line rule was rewritten as if it were live, which also skipped the omarchy_monitor_scale fallback. The same freedom made a failed match exponential: a rule with twenty inline comments took four seconds and forty did not finish. Atomic groups fix all three. The unwritten-config test also clears the eval output, so a stale one from the case before cannot satisfy it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-Authored-By: Codex Medium <[email protected]>
|
Re-tested at 751ee58 on an Omarchy worker running Hyprland 0.56.2, with two outputs side by side.
Codex Medium gave the second opinion on this head. It found no remaining defect in the matching, confirmed the atomic Nothing is left for you. #13605 fixes the same scale bug a different way. This one is older and also keeps the position, so it is the one recommended, but which lands is the maintainer's call. |
|
This branch now conflicts with
The Perl rewrite of This was checked by reading Thanks @f1n3d for the work here; the earlier rounds did find real cases. Closing this or keeping just the geometry check is now the maintainer's decision. |
Setting the display scale from the Display panel destroys explicit multi-monitor layouts and does not survive a reboot for per-output configs.
What was wrong (bin/omarchy-hyprland-monitor-scaling):
What this changes:
;separators and comments, and only replaces a whole scalar value — an expression stays whole. Generic configs behave exactly as before.Scope: recomputing positions when a scale change alters the focused monitor's logical size is not addressed here. Keeping the position stops the collapse, but a neighbour at a fixed x keeps its old coordinate — a gap when scaling up, an overlap when scaling down — which is #13062's request; #11854 carries that recompute. This PR deliberately only stops explicit layouts from being destroyed.
Tests: extended test/shell.d/monitor-scaling-test.sh (stub now reports x/y) with cases for position preserved, refresh rate kept, explicit per-output persistence (including entries that read omarchy_monitor_scale, nested tables, semicolon separators, and trailing/block comments), scale expressions left whole, and automatic scales — monitor-scaling is 24/24. All other monitor suites pass (monitor, monitor-state, monitor-output-name, monitor-recovery, monitor-clamshell-scale, monitor-modeless, hw-external-monitors, sleep-monitor). Full ./test/shell shows only the pre-existing environment failures also present without this change. Also verified end-to-end against a real 2x DP 1920x1080 layout: DP-2 at 1920x0 scales to 1.6 while DP-1 is untouched.
Related: #10922, #13062, #11854, #13605, #7625, #6673. The display on/off toggle itself (#6968, PR #7036) is deliberately out of scope here.
Fixes #13229