Repository navigation
Resize monitors without overlap, and migrate older monitors.lua files - #17166
Conversation
A scale or resolution change applied the new size first and moved the neighbours after, so a monitor that grew sat over its neighbour for a moment and Hyprland warned about overlapping monitors. The layout command now takes the new mode and applies it in the same eval as the moves, ordered so no step overlaps: the neighbours moving away first, then the monitor, then the ones closing in. Saving no longer replays a monitor's settings either, which could apply the new size on its own; it only brings GDK_SCALE up to date. Co-Authored-By: Claude Opus 5.5 <[email protected]>
An older hypr/monitors.lua still carries Omarchy's monitor defaults and the display panel's scale as connector rules. A migration now runs omarchy-hyprland-monitor-config-upgrade, which turns it into the new template plus whatever else it held: the old defaults go, or become plain lines where they were changed; a one-line connector rule with only a mode, position and scale becomes the saved settings of the monitor behind it, when that monitor is known; every other line is kept below the template. The old file is kept as monitors.lua.bak.<time>. Co-Authored-By: Claude Opus 5.5 <[email protected]>
[Medium impact] The PR appears safe to merge, with a remaining non-blocking overlap-warning case from the previous review. Findings
SummaryUpdates monitor resizing and replaces the older config rewrite with a more conservative upgrade.
|
| | unpile | ||
| | (map(.x = .ox | .y = .oy)) as $old | ||
| | if piled and ($old | piled | not) then $old else . end | ||
| | sort_by(if .name == $name then 1 elif .x > .ox or .y > .oy then 0 else 2 end) |
There was a problem hiding this comment.
Moving neighbours can still overlap
All monitors moving away receive the same sort key, so their moves are not ordered by which destination is free. With three adjacent screens, growing the left screen can move the middle screen into the right screen's old space before the right screen moves away. The overlap warning can therefore remain for longer rows. Order moves by which destinations are free, and add a three-screen chain case.
There was a problem hiding this comment.
Fixed in f2034a5: neighbours moving away go farthest first and ones closing in go nearest first, so none moves into a spot another hasn't left. Added three-screen row cases for growing and shrinking.
The upgrade read monitors.lua line by line as if it understood Lua, so a block comment's contents became live config, a rule inside a conditional was lifted into saved settings, and a custom scale built from an earlier local lost it. It now keeps the old file exactly as written below the new template and drops only lines Omarchy itself shipped there: its old comments and examples, and its defaults where they're unchanged and nothing else uses them. A file that already opens like the template is left alone. Its tests join monitor-scaling-test.sh. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every neighbour moving away shared one place in the eval, so in a row of three the middle screen could move into the far one's spot before it had left. Neighbours moving away now go farthest first, and ones closing in nearest first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two follow-ups to #17159.
No overlap warning when a monitor resizes
Changing a monitor's scale or resolution applied the new size first and moved its neighbours after, so a monitor that grew sat over its neighbour for a moment and Hyprland showed its "monitor layout is set up incorrectly" warning. Seen switching a Pro Display from 5K to 6K above a laptop.
omarchy-hyprland-monitor-layout --resizedtakes the new mode and applies it in the same eval as the neighbour moves, ordered so no step overlaps: neighbours moving away first (farthest first), then the monitor, then neighbours closing in (nearest first).omarchy-hyprland-monitor-persistonly bringsGDK_SCALEup to date, through a newupdate_gdk_scale().Migrate older monitors.lua files
Older
hypr/monitors.luafiles still carry Omarchy's old defaults (omarchy_monitor_scale,omarchy_gdk_scale, the catch-all rule) and the comments explaining them. A migration runs the new hiddenomarchy-hyprland-monitor-config-upgrade, which puts the new template on top and keeps the old file below it, minus only lines Omarchy itself shipped there:omarchy_monitor_scale = "auto"with its catch-all rule,omarchy_gdk_scale = 2with itsGDK_SCALEline), only when unchanged and nothing else uses them.Everything else stays exactly as written and in order, since it's the user's own Lua: connector rules, changed defaults, rotation, VRR, block comments, conditionals. Saved panel choices still win over a rule for the same monitor. The old file is kept as
monitors.lua.bak.<time>, and a file that already opens like the new template is left alone.An earlier version interpreted the file line by line and moved connector rules into saved settings; Codex and Greptile found it could activate block-commented rules, lift conditional ones and break locals, so it was replaced before shipping.
Tested with grow, shrink and three-in-a-row resize orderings, the upgrade's cases (old defaults, block comments and conditionals kept verbatim and still loadable, changed defaults and ones still in use, an already-new file), and a dry run against a real older monitors.lua.
🤖 Generated with Claude Code