From dafc400891437267da5684fc0ab9aa4e240d07d7 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 29 Jun 2026 13:24:56 -0500 Subject: [PATCH] Move monitor scaling off Super slash --- bin/omarchy-hyprland-monitor-scaling | 8 +++----- default/hypr/bindings/tiling.lua | 4 ++-- test/shell.d/monitor-scaling-test.sh | 12 +++++++++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/bin/omarchy-hyprland-monitor-scaling b/bin/omarchy-hyprland-monitor-scaling index 51c00211..10530419 100755 --- a/bin/omarchy-hyprland-monitor-scaling +++ b/bin/omarchy-hyprland-monitor-scaling @@ -5,7 +5,6 @@ # omarchy:examples=omarchy hyprland monitor scaling | omarchy hyprland monitor scaling 1.6 | omarchy hyprland monitor scaling up | omarchy hyprland monitor scaling down SCALES=(1 1.25 1.6 2 3 4) -STEP_SCALES=(1 1.25 1.6 2) usage() { echo "Usage: omarchy-hyprland-monitor-scaling [up|down|1|1.25|1.6|2|3|4]" @@ -43,9 +42,8 @@ set_scale() { scale_from_current() { local direction="${1:-}" - local scale_list="${2:-${SCALES[*]}}" - awk -v direction="$direction" -v list="$scale_list" ' + awk -v direction="$direction" -v list="${SCALES[*]}" ' NR == 1 { scale = $0; found = 1 } END { if (!found) exit 1 @@ -86,10 +84,10 @@ case "${1:-}" in usage ;; up) - set_scale "$(focused_monitor_scale | scale_from_current next "${STEP_SCALES[*]}")" + set_scale "$(focused_monitor_scale | scale_from_current next)" ;; down) - set_scale "$(focused_monitor_scale | scale_from_current previous "${STEP_SCALES[*]}")" + set_scale "$(focused_monitor_scale | scale_from_current previous)" ;; 1 | 1.25 | 1.6 | 2 | 3 | 4) set_scale "$1" diff --git a/default/hypr/bindings/tiling.lua b/default/hypr/bindings/tiling.lua index 9221004a..cc6c8528 100644 --- a/default/hypr/bindings/tiling.lua +++ b/default/hypr/bindings/tiling.lua @@ -91,5 +91,5 @@ for index = 1, 5 do o.bind("SUPER + ALT + code:" .. tostring(index + 9), "Switch to group window " .. index, hl.dsp.group.active({ index = index })) end -o.bind("SUPER + code:61", "Monitor scaling up", "omarchy-hyprland-monitor-scaling up") -o.bind("SUPER + ALT + code:61", "Monitor scaling down", "omarchy-hyprland-monitor-scaling down") +o.bind("SUPER + CTRL + ALT + code:21", "Monitor scaling up", "omarchy-hyprland-monitor-scaling up") +o.bind("SUPER + CTRL + ALT + code:20", "Monitor scaling down", "omarchy-hyprland-monitor-scaling down") diff --git a/test/shell.d/monitor-scaling-test.sh b/test/shell.d/monitor-scaling-test.sh index a7636fd8..2f5f4611 100644 --- a/test/shell.d/monitor-scaling-test.sh +++ b/test/shell.d/monitor-scaling-test.sh @@ -11,6 +11,7 @@ stub_bin="$test_tmp/bin" eval_out="$test_tmp/hyprctl-eval" home_dir="$test_tmp/home" monitor_lua="$home_dir/.config/hypr/monitors.lua" +tiling_lua="$ROOT/default/hypr/bindings/tiling.lua" mkdir -p "$stub_bin" "$home_dir/.config/hypr" @@ -44,9 +45,9 @@ run_scaling() { write_monitor_config OMARCHY_TEST_MONITOR_SCALE=2 run_scaling up -grep -F 'scale = 2' "$eval_out" >/dev/null || fail "monitor scaling up stops at 2x" -grep -Fx 'local omarchy_monitor_scale = 2' "$monitor_lua" >/dev/null || fail "monitor scaling up does not persist 3x from 2x" -pass "monitor scaling up stops at 2x" +grep -F 'scale = 3' "$eval_out" >/dev/null || fail "monitor scaling up reaches 3x" +grep -Fx 'local omarchy_monitor_scale = 3' "$monitor_lua" >/dev/null || fail "monitor scaling up persists 3x" +pass "monitor scaling up reaches 3x" write_monitor_config OMARCHY_TEST_MONITOR_SCALE=3 run_scaling down @@ -63,3 +64,8 @@ pass "monitor scaling explicit 3x remains available" scale=$(OMARCHY_TEST_MONITOR_SCALE=3 run_scaling) [[ $scale == "3" ]] || fail "monitor scaling reports explicit 3x scale" "actual: $scale" pass "monitor scaling reports explicit 3x scale" + +! grep -F 'SUPER + code:61' "$tiling_lua" >/dev/null || fail "monitor scaling is not bound to Super+Slash" +grep -F 'SUPER + CTRL + ALT + code:21", "Monitor scaling up"' "$tiling_lua" >/dev/null || fail "monitor scaling up uses deliberate Equal chord" +grep -F 'SUPER + CTRL + ALT + code:20", "Monitor scaling down"' "$tiling_lua" >/dev/null || fail "monitor scaling down uses deliberate Minus chord" +pass "monitor scaling uses deliberate global shortcuts"