Internal monitor scale reverts to 2 when monitors.lua has multi-line hl.monitor({...}) entries
Internal monitor scale keeps reverting to 2 when monitors.lua has multi-line hl.monitor({...}) entries
What happened
With a laptop + one external monitor connected, the internal panel's scale
keeps snapping back to 2 every few seconds — even after setting it via the
quickshell monitor panel widget (Super, monitor icon) or manually reloading.
It happens continuously with no user action, roughly every 2 seconds.
Expected behavior
The internal monitor's scale should stay at whatever is configured in
~/.config/hypr/monitors.lua while docked with an external monitor active.
Root cause
/usr/share/omarchy/bin/omarchy-hyprland-monitor-clamshell runs
sync_internal_scale on a 2-second poll (poll_clamshell_state, started
whenever omarchy-hw-laptop && omarchy-hyprland-monitor-external-active) to
keep the internal panel's scale in sync with monitors.lua.
It reads the desired scale with configured_monitor_scale →
configured_monitor_value, which greps monitors.lua with a line-anchored
regex:
monitor_rule_regex() {
printf '^[[:space:]]*hl\\.monitor\\(\\{.*output[[:space:]]*=[[:space:]]*"%s"' "$1"
}
This only matches when hl.monitor({ and output = "<name>" appear on the
same line. But nwg-displays (a common third-party tool for configuring
Hyprland monitor layout, since Omarchy has no built-in GUI for this) writes
each monitor as a multi-line block:
hl.monitor({
output = "eDP-1",
mode = "[email protected]",
position = "1536x0",
scale = 1.25
})
Against that shape, configured_monitor_value finds no match, so
configured_monitor_scale falls through every fallback (catch-all rule,
omarchy_monitor_scale local) and read_monitor_scale hits its final
hardcoded default:
read_monitor_scale() {
...
echo 2
}
Every ~2 seconds, the poll compares this bogus "desired" value (2) against
the actual live scale, sees a mismatch, and calls
hyprctl eval "hl.monitor({ output = \"$INTERNAL\", ... scale = 2 })" to
"fix" it — permanently fighting any other scale you set.
Steps to reproduce
- On a laptop with an external monitor, run
nwg-displays, arrange monitors, set internal panel scale to something other than2(e.g.1.25), and save. - Confirm
~/.config/hypr/monitors.luanow has multi-linehl.monitor({...})blocks (this is nwg-displays' default output format). hyprctl reload, then watchhyprctl monitors | grep scalefor the internal output over the next ~5-10 seconds.- Scale reverts to
2on its own, with no user action.
Confirmed by the change-audit log at
~/.local/state/omarchy/monitor-scaling.log, which shows current=2 on
every widget-driven correction, moments after scale had already been set
correctly.
Workaround
Manually collapse each hl.monitor({...}) block in monitors.lua to a
single line so the regex can match it. This holds until the file is
re-saved by a tool that reformats it back to multi-line (e.g. re-saving from
nwg-displays).
Suggested fix
Make configured_monitor_value/monitor_rules tolerant of multi-line
hl.monitor({...}) tables (e.g. join the file into one logical stream per
table before matching), since multi-line output is the default/common style
from tools like nwg-displays, not just hand-edited files.
System info
- Omarchy: 4.0.0-1
- Hyprland: 0.56.2-1
- Kernel:
7.1.8-arch1-3 - GPU: NVIDIA GeForce GTX 1050 Max-Q (hybrid, AMD Vega iGPU also present)
- Laptop internal panel: eDP-1, 1920x1080, BOE panel
- External monitor: Lenovo S24e-20, HDMI-A-1, 1920x1080
Same root cause reproduced on Omarchy 4.0.0-1 / Hyprland 0.56.2 against main (06e32d2), and there is now a fix in #8808.
monitor_rule_regex in omarchy-hyprland-monitor-clamshell only matches a rule written on one line and keyed by connector name, so both a desc:-keyed rule and a multi-line hl.monitor({ ... }) table parse as nothing and the panel falls through to the catch-all:
monitors.lua form |
configured_monitor_scale |
read_monitor_position |
|---|---|---|
| single line, connector name | 1.6 |
0x0 |
desc: keyed |
auto |
auto |
| multi-line table | auto |
auto |
#8808 folds each hl.monitor({ ... }) call onto one line before matching and looks the panel up by connector name first, then by any desc: rule whose text prefixes the panel's description (Hyprland's own desc: matching). A panel that no rule names still falls through to the catch-all, so the shipped default config is unaffected.
This is the same bug as #8123, opened a day earlier, so I'm closing this one in favour of it. Both reports describe the internal panel's scale snapping back to 2 every couple of seconds while docked, after nwg-displays writes monitors.lua as multi-line hl.monitor({ ... }) blocks. Both trace it to the same place: monitor_rule_regex in bin/omarchy-hyprland-monitor-clamshell only matches a rule whose output = "..." sits on the same line as hl.monitor({. That regex is unchanged on current quattro (c352b62d).
The fixes are tracked on #8123: #7146 removes the reader entirely so Hyprland applies your rule however it is formatted, and #8808 and #14583 teach the parser multi-line rules instead. Which one lands is the maintainer's call. Your workaround of collapsing each block onto one line still holds until then.
Compared by Claude Opus 5.5 in Claude Code, with Codex Medium asked separately whether the two reports are the same. If they turn out to be different bugs, this can be reopened.