Lua config: Apply with Transform "Normal" leaves a rotated monitor rotated
Describe the bug
With a Lua Hyprland config, after a monitor has been rotated, setting Transform back to "Normal"
in the advanced settings (c) and pressing Apply (a) leaves the monitor rotated. Saving (s)
does un-rotate it, because save reloads the config.
Cause
generateLuaMonitorRule adds transform only when it is non-zero:
if m.Transform > 0 {
fields = append(fields, fmt.Sprintf("transform = %d", m.Transform))
}
Apply on a Lua config sends that rule with hyprctl eval (applyMonitorLua). For "Normal" the
rule has no transform field, and Hyprland keeps the monitor's current transform for a field
the rule leaves out. A config reload starts from defaults, which is why save works.
To reproduce (Hyprland side, without HyprMon)
mon=HDMI-A-1 # any secondary output
rule="hl.monitor({ output = \"$mon\", mode = \"preferred\", position = \"auto\", scale = 1"
tf() { hyprctl -j monitors | jq ".[] | select(.name==\"$mon\").transform"; }
hyprctl eval "$rule, transform = 3 })"; tf # 3: rotated
hyprctl eval "$rule })"; tf # 3: what Apply sends for "Normal"; still rotated
hyprctl eval "$rule, transform = 0 })"; tf # 0: back to landscape
To reproduce (HyprMon)
- Lua config (
hyprland.luawith therequire("hyprmon")include). - Select a monitor,
c, set Transform to 270°, Enter,a: the monitor rotates. c, set Transform to Normal, Enter,a: the monitor stays rotated.- Quit and start HyprMon again: it reads transform 3 from Hyprland, so a later
ssavestransform = 3back intohyprmon.lua.
Expected
Apply with "Normal" returns the monitor to landscape.
Suggested fix
Always emit transform in generateLuaMonitorRule for enabled monitors. 0 is Hyprland's default
for transform, so writing it is always correct (unlike vrr, where leaving it out means "use
the global misc:vrr"). The hyprlang paths have the same > 0 guard; I have not tested whether
hyprctl keyword monitor keeps the old transform there.
Environment
- Hyprland 0.56.2, Lua config
- HyprMon built from source; code checked against master at 48e118c (2026-11-02), and the
installed binary contains
applyMonitorLua