Fix monitor scaling down getting stuck at 3x due to floating point drift
Hyprland can report a scale set to 3 as something like 3.0000000000000004. The previous directional comparison treated that as above the 3 preset, so Super+Alt+Slash (scale down) would stay at 3 instead of reaching 2. Snap the reported scale to the nearest preset first, then step up/down. Add a regression test for the floating-point case.
This commit is contained in:
@@ -57,6 +57,12 @@ grep -F 'scale = 2' "$eval_out" >/dev/null || fail "monitor scaling down recover
|
||||
grep -Fx 'local omarchy_monitor_scale = 2' "$monitor_lua" >/dev/null || fail "monitor scaling down persists 2x from 3x"
|
||||
pass "monitor scaling down recovers 3x to 2x"
|
||||
|
||||
write_monitor_config
|
||||
OMARCHY_TEST_MONITOR_SCALE=3.0000000000000004 run_scaling down
|
||||
grep -F 'scale = 2' "$eval_out" >/dev/null || fail "monitor scaling down snaps floating point 3x to 2x"
|
||||
grep -Fx 'local omarchy_monitor_scale = 2' "$monitor_lua" >/dev/null || fail "monitor scaling down persists 2x from floating point 3x"
|
||||
pass "monitor scaling down snaps floating point 3x to 2x"
|
||||
|
||||
write_monitor_config
|
||||
OMARCHY_TEST_MONITOR_SCALE=2 run_scaling 3
|
||||
grep -F 'scale = 3' "$eval_out" >/dev/null || fail "monitor scaling explicit 3x remains available"
|
||||
|
||||
Reference in New Issue
Block a user