Write monitor rules that survive a cable swap or a dock replug
Symptom
Your carefully written per-monitor rules stop matching after you move a cable, replug a dock, or reboot. The same physical screen is now DP-3 instead of DP-2, so the scale/position/refresh rule silently does not apply and everything comes up at defaults.
Cause
Connector names (DP-1, HDMI-A-1, DP-5) are assigned by the kernel per port and are not stable across cable swaps, dock topologies or GPU driver changes. Rules keyed on the connector name break whenever the numbering shifts.
Fix
Key rules on the monitor's EDID description instead, using the desc: prefix. Get the description:
hyprctl monitors | grep -E '^Monitor|description:'
# Monitor eDP-1 (ID 0):
# description: Chimei Innolux Corporation 0x150C (eDP-1)
Use everything up to but **not including** the (portname):
hl.monitor({ output = "desc:Chimei Innolux Corporation 0x150C", mode = "preferred", position = "auto", scale = 1.5 })
hl.monitor({ output = "desc:Dell Inc. DELL U2723QE 8CJ2P43", mode = "3840x2160@60", position = "auto-right", scale = 1.5 })
hl.monitor({ output = "", mode = "preferred", position = "auto", scale = 1 }) -- keep the fallback last
On Hyprland <= 0.54: monitor=desc:Dell Inc. DELL U2723QE 8CJ2P43,3840x2160@60,auto,1.5.
Verify
Move the cable to a different port and reboot: hyprctl monitors -j | jq -c '.[] | {name,description,scale,x,y}' shows the rule still applied on the new connector name.