Fix monitors in the wrong order or with a dead gap between them
Symptom
Two monitors are in the wrong order (you move the mouse right and it lands on the left screen), or there is a dead gap you have to drag the pointer through, or Hyprland warns that monitors overlap. Setting position = "3840x0" for a screen next to a 4K display does not put it where you expect.
Cause
Hyprland positions monitors on a virtual layout in *scaled logical* pixels, not physical pixels. A 3840x2160 display at scale 2 is 1920 logical pixels wide, so the monitor to its right starts at x=1920. A rotated (transform 1/3) monitor contributes its rotated logical size. Getting this wrong either leaves a gap or makes the outputs overlap, which Hyprland refuses.
Fix
Compute positions from the scaled resolution. Example: 4K at scale 2 on the left, 1080p at scale 1 on the right:
hl.monitor({ output = "DP-1", mode = "3840x2160@144", position = "0x0", scale = 2 })
hl.monitor({ output = "DP-2", mode = "1920x1080@60", position = "1920x0", scale = 1 })
A 1440p panel rotated 90 degrees to the left of a 1080p one (rotated logical width = 1440):
hl.monitor({ output = "DP-1", mode = "2560x1440@60", position = "-1440x0", scale = 1, transform = 1 })
hl.monitor({ output = "DP-2", mode = "1920x1080@60", position = "0x0", scale = 1 })
Y is inverted-cartesian: a negative y puts a monitor *higher*. If you just want them auto-arranged left-to-right, use the special values:
hl.monitor({ output = "DP-2", mode = "preferred", position = "auto-right", scale = 1 })
-- also: auto, auto-left/up/down, auto-center-right/left/up/down
Read back what Hyprland actually computed:
hyprctl monitors -j | jq -c '.[] | {name, x, y, width, height, scale, transform}'
Verify
The pointer crosses from one screen to the other with no gap and in the physical direction you expect, and no overlap warning is drawn.