Internal monitor position cannot be made to stick: clamshell watcher and Display panel scaling both re-apply position = "auto"
System details
Dell Latitude E5470 · Intel Core i5-6440HQ · Omarchy 4.0.0-1 · Hyprland 0.56.2 · internal eDP-1 1366x768 + external HDMI-A-1 1920x1080
What's wrong?
On a laptop with an external monitor, an explicit position for the internal panel cannot be made to stick. Two separate code paths re-apply the internal monitor with position = "auto", so any manual arrangement is discarded within about a second — and with the stock monitors.lua, this happens to everyone, not just users with an unusual config.
The Display panel offers brightness, text size, scale and enable/disable, but no way to arrange monitors, so laying them out at all means editing config or reaching for a third-party tool — which then loses the race described below.
This is adjacent to #7084 and #6673 but is a distinct defect: those concern scale (desc:-keyed rules, and global-vs-per-monitor persistence). This one is about position, and it reproduces with connector-name rules and the shipped defaults. Happy to have it folded into #7084 if maintainers see them as one bug in omarchy-hyprland-monitor-clamshell.
Root cause 1 — the default config guarantees the fallback
bin/omarchy-hyprland-monitor-clamshell:
read_monitor_position() {
local position
position=$(configured_internal_monitor_value position)
if [[ $position =~ ^[-[:alnum:]_.+]+$ ]]; then
echo "$position"
return
fi
echo auto
}
enable_internal_output() {
...
position=$(read_monitor_position)
hyprctl eval "hl.monitor({ output = \"$INTERNAL\", mode = \"preferred\", position = \"$position\", scale = $scale })" ...
}
configured_internal_monitor_value matches only a rule keyed by the internal connector name:
printf '^[[:space:]]*hl\\.monitor\\(\\{.*output[[:space:]]*=[[:space:]]*"%s"' "$1"
But the monitors.lua Omarchy ships contains no such rule — only the generic catch-all:
hl.monitor({ output = "", mode = "preferred", position = "auto", scale = omarchy_monitor_scale })
So on a stock install the lookup finds nothing, read_monitor_position returns auto, and the watcher re-asserts the internal panel auto-placed. Unlike the scale path — which has a documented fallback chain ending at omarchy_monitor_scale — position has no equivalent: it does not consult the catch-all's position, it just goes to auto.
omarchy-hyprland-monitor-watch calls this on every monitor event (and on a timer while docked), so the override is effectively immediate and repeating.
Root cause 2 — the Display panel's scale buttons discard position
bin/omarchy-hyprland-monitor-scaling:
hyprctl eval "hl.monitor({ output = \"$active_monitor\", mode = \"${width}x${height}@${refresh_rate}\", position = \"auto\", scale = $new_scale })" >/dev/null
position = "auto" is hardcoded, so changing scale from the Display panel re-places that monitor regardless of any configured position. This one affects external monitors too, not just the internal panel.
Steps to reproduce
- Laptop with an external monitor connected, stock
~/.config/hypr/monitors.lua. - Give the two monitors a deliberate layout — e.g. centre the internal panel vertically against the external one:
hyprctl keyword monitor "eDP-1,1366x768@60,1920x156,1" hyprctl monitors | grep -A2 eDP-1→ position is correct for about a second.- Trigger any monitor event, or just wait while docked.
Expected: the layout holds.
Actual: eDP-1 snaps back to an auto-assigned position (here 1920x0), losing the vertical offset. Pressing any scale button in the Display panel does the same thing immediately, and to whichever monitor is focused.
Workaround
Add an explicit connector-name rule for the internal panel to monitors.lua, so the clamshell lookup finds a position instead of falling back to auto:
hl.monitor({ output = "HDMI-A-1", mode = "preferred", position = "0x0", scale = omarchy_monitor_scale })
hl.monitor({ output = "eDP-1", mode = "preferred", position = "1920x156", scale = omarchy_monitor_scale })
Keeping scale = omarchy_monitor_scale rather than a literal preserves the Display panel's scale persistence, which rewrites the local omarchy_monitor_scale line.
This holds across monitor events, but is still undone for the focused monitor whenever a Display-panel scale button is pressed (root cause 2).
Suggested fix
- Give
read_monitor_positiona fallback chain mirroringconfigured_monitor_scale: internal rule → catch-all rule →auto. That alone would make an explicitly positioned catch-all survive. - Better, have
enable_internal_outputomitpositionentirely when the config does not specify one, instead of assertingauto. Re-assertingautoactively destroys a layout the user may have set through any other route; saying nothing leaves the current placement intact. - In
omarchy-hyprland-monitor-scaling, preserve the monitor's current position instead of hardcodingposition = "auto"— it can be read fromhyprctl monitors -jbefore the change. - Longer term, the Display panel having any monitor-arrangement affordance would remove the need for users to hand-edit or use external tools here (cf. the closed #2858).
Confirmed the Display-panel scaling half of this issue on a desktop with two external monitors.
Environment
- Hyprland 0.56.2
- Samsung
DP-3, 5120×1440@120 - ASUS
HDMI-A-1, 2560×[email protected] - Explicit layout in
monitors.lua:
hl.monitor({ output = "DP-3", mode = "5120x1440@120", position = "0x0", scale = 1 })
hl.monitor({ output = "HDMI-A-1", mode = "[email protected]", position = "5120x0", scale = 1 })
Reproduction
- Reload Hyprland. The configured layout is applied correctly:
DP-3:0x0HDMI-A-1:5120x0
- Focus a window on the left monitor (
DP-3). - Invoke monitor scaling in either direction.
This reproduces with both a real scale change and a no-op attempt at the lower limit:
requested=down current=1 new=1 monitor=DP-3
Afterward, the live layout becomes:
HDMI-A-1 position=0x0
DP-3 position=2560x0
The monitors have effectively switched sides. hyprctl reload immediately restores the configured layout.
Running the same scaling actions with the right monitor focused appears correct only by coincidence: automatic placement puts that monitor after the left monitor, which is already its intended position.
This confirms that the hardcoded position = "auto" in omarchy-hyprland-monitor-scaling discards explicit monitor coordinates whenever scaling is invoked, even if the calculated scale does not change.
The scaling command should preserve the focused monitor’s current coordinates. It could additionally skip the runtime monitor update when new_scale equals current_scale, although that alone would not fix genuine scale changes.
It looks like linked PR #7408 primarily changes multiline monitor-rule parsing in the clamshell code. Unless I am overlooking another change, it does not appear to address this scaling-command path.
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.
I've opened https://github.com/omacom/omarchy/pull/10664, which fixes part of this. Worth being explicit about which part, because it is not the whole issue and it does not take the route suggested here.
It covers root cause 1, and only in the clamshell path. The internal panel comes back from a dock at position = "auto", and auto appends it after whatever is already placed, so it lands on the wrong side of a monitor that stayed up. @mokkabonna's measurement above is the same ordering seen from the scaling path.
On the suggested fix, I went a different way and want to say why. The first suggestion is to give read_monitor_position a fallback chain of internal rule, then catch-all rule, then auto. I did not do that. The chain is internal rule, then the position the panel actually had, then auto.
Reading the catch-all's position teaches the reader one more rule about how Hyprland resolves config, and that reader already gets other shapes wrong (desc: keys and multi-line rules, see #7084, #8123, #8335). Saving the panel's live position off hyprctl monitors before it goes down needs no such rule. It covers the stock config, which has no position for the internal panel to read anywhere, and it is right by construction, since whatever the panel was at is what it comes back to.
The second suggestion, omitting position entirely rather than asserting auto, gets to the same place for a layout that is already correct. It says nothing about the recovery case, where the panel is coming back from disabled and needs a position. Saving one covers both.
An explicit rule for the internal output still wins over the saved value, so the workaround documented in this issue keeps working unchanged.
Confirming the Display-panel scaling half of this on another setup, and adding a workaround, since the thread does not have one yet.
Environment
- Omarchy 4.0.4-1, Hyprland 0.56.2
- Internal
eDP-11920x1080 + external Dell P2419H onHDMI-A-11920x1080 ~/.config/hypr/monitors.luapins explicit positions: external at0x0, internal stacked below at0x1080
What happens
Changing the internal panel's scale from the Display panel moves it. set_scale() applies the focused output with position = "auto", and auto-placement puts the rescaled internal panel beside the external at 1920x0 instead of below it at 0x1080. The arrangement then no longer matches the physical setup, so the cursor crosses at the wrong edge until the config is reloaded.
Worth adding to root cause 2: the inconsistency sits inside a single function. The persistence step is guarded on the user still having the stock catch-all config...
# Persist to monitors.lua if the user still has Omarchy's generic catch-all
# defaults, so the scale survives reboots.
if [[ -f $monitor_lua ]] && grep -q '^local omarchy_monitor_scale = ' "$monitor_lua"; then
...while the hyprctl eval apply a few lines above it has no equivalent check and re-places the output unconditionally. Since the shipped monitors.lua explicitly invites per-output positions:
-- Configure a specific monitor.
-- hl.monitor({ output = "DP-2", mode = "2560x1440@144", position = "0x0", scale = 1 })
the two halves of the same function disagree about whether a custom config exists.
Workaround
Re-assert the position from Lua on monitor.layout_changed. Append this to ~/.config/hypr/monitors.lua after the explicit hl.monitor() lines, with the positions set to match them:
local positions = {
["eDP-1"] = "0x1080",
["HDMI-A-1"] = "0x0",
}
local repositioning = false
local function reassert_positions()
if repositioning then
return
end
repositioning = true
for _, monitor in ipairs(hl.get_monitors()) do
local wanted = positions[monitor.name]
if wanted and wanted ~= monitor.x .. "x" .. monitor.y then
-- Carry the LIVE scale, never one read from this file.
hl.monitor({
output = monitor.name,
mode = "preferred",
position = wanted,
scale = monitor.scale,
})
end
end
repositioning = false
end
hl.on("monitor.layout_changed", reassert_positions)
One detail matters: the re-apply has to pass monitor.scale (the live value) rather than a scale read from the config. set_scale() seds monitors.lua, and with misc:disable_autoreload = false that write trips an autoreload, so any scale captured at parse time is already stale and re-applying it would revert the change the user just made. Passing the live scale corrects position only and leaves the Display panel in charge of scale.
The re-entry guard is there because hl.monitor() inside the handler can itself trigger monitor.layout_changed. An already-correct layout emits no calls, so it settles rather than looping.
Verified on 4.0.4-1: forcing the panel out of place with
hyprctl eval 'hl.monitor({ output = "eDP-1", mode = "preferred", position = "1920x0", scale = 1.6 })'
returns it to 0x1080 within about a second with the scale preserved, and Display-panel scale changes no longer rearrange the layout. For rules keyed by desc: rather than connector name, match on monitor.description instead of monitor.name.
This is a workaround, not a fix: the scaling script still needs to stop passing auto. Note that #10664 only touches bin/omarchy-hyprland-monitor-clamshell, so the Display-panel path described in root cause 2 here remains unaddressed.
I checked both halves of this against current quattro (b83d3df), reading the source only. Nothing was run, because each half already has an open fix pull request. Codex at medium effort reviewed the same code separately and reached the same conclusions; since both models read the same tree, treat its agreement as a second read rather than an independent result.
Display-panel scaling (root cause 2): confirmed in source, still present. set_scale in bin/omarchy-hyprland-monitor-scaling sends position = "auto" for the focused output on every call, even when the clamped scale does not change. Any explicit layout for that monitor is discarded, as @mokkabonna and @GermanGomez182 measured. Three open pull requests fix it:
- #7495 drops
positionfrom the eval. - #13142 passes the monitor's live position.
- #11854 recomputes the position from the new scale.
They compete with each other, and #7495 is the oldest.
Clamshell watcher (root cause 1): narrower on quattro than described. Since #7581 (b636164, in 4.0.0 and later), sync_internal_scale returns early when the configured scale is not a number and the panel is already enabled. So with the stock monitors.lua, an enabled internal panel is no longer re-placed on monitor events or by the 2-second docked poll. enable_internal_output still sends position = "auto" in two cases:
- when the panel comes back from clamshell and is still disabled after the reload;
- when a numeric configured scale differs from the live one, and no rule keyed by connector name gives a position.
#10664 covers the recovery case by saving the panel's live position before it goes down. #8808 covers desc:-keyed and multi-line rules, so the lookup finds a configured position more often.
Codex also pointed to the Display panel's enable toggle (shell/plugins/panels/monitor/Panel.qml), which re-enables an output at position = "auto". That is the same recovery shape as the clamshell case, and none of the pull requests above touch it.
I have not added Fixes #7326 to any of these pull requests. Each one fixes one half, so whichever merged first would close this issue with the other half still open. This now waits on the maintainer: pick among the scaling fixes and decide on #10664. Each pull request is being reviewed on its own.