Move monitor scaling off Super slash
This commit is contained in:
@@ -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
|
# 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)
|
SCALES=(1 1.25 1.6 2 3 4)
|
||||||
STEP_SCALES=(1 1.25 1.6 2)
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: omarchy-hyprland-monitor-scaling [up|down|1|1.25|1.6|2|3|4]"
|
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() {
|
scale_from_current() {
|
||||||
local direction="${1:-}"
|
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 }
|
NR == 1 { scale = $0; found = 1 }
|
||||||
END {
|
END {
|
||||||
if (!found) exit 1
|
if (!found) exit 1
|
||||||
@@ -86,10 +84,10 @@ case "${1:-}" in
|
|||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
up)
|
up)
|
||||||
set_scale "$(focused_monitor_scale | scale_from_current next "${STEP_SCALES[*]}")"
|
set_scale "$(focused_monitor_scale | scale_from_current next)"
|
||||||
;;
|
;;
|
||||||
down)
|
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)
|
1 | 1.25 | 1.6 | 2 | 3 | 4)
|
||||||
set_scale "$1"
|
set_scale "$1"
|
||||||
|
|||||||
@@ -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 }))
|
o.bind("SUPER + ALT + code:" .. tostring(index + 9), "Switch to group window " .. index, hl.dsp.group.active({ index = index }))
|
||||||
end
|
end
|
||||||
|
|
||||||
o.bind("SUPER + code:61", "Monitor scaling up", "omarchy-hyprland-monitor-scaling up")
|
o.bind("SUPER + CTRL + ALT + code:21", "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:20", "Monitor scaling down", "omarchy-hyprland-monitor-scaling down")
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ stub_bin="$test_tmp/bin"
|
|||||||
eval_out="$test_tmp/hyprctl-eval"
|
eval_out="$test_tmp/hyprctl-eval"
|
||||||
home_dir="$test_tmp/home"
|
home_dir="$test_tmp/home"
|
||||||
monitor_lua="$home_dir/.config/hypr/monitors.lua"
|
monitor_lua="$home_dir/.config/hypr/monitors.lua"
|
||||||
|
tiling_lua="$ROOT/default/hypr/bindings/tiling.lua"
|
||||||
|
|
||||||
mkdir -p "$stub_bin" "$home_dir/.config/hypr"
|
mkdir -p "$stub_bin" "$home_dir/.config/hypr"
|
||||||
|
|
||||||
@@ -44,9 +45,9 @@ run_scaling() {
|
|||||||
|
|
||||||
write_monitor_config
|
write_monitor_config
|
||||||
OMARCHY_TEST_MONITOR_SCALE=2 run_scaling up
|
OMARCHY_TEST_MONITOR_SCALE=2 run_scaling up
|
||||||
grep -F 'scale = 2' "$eval_out" >/dev/null || fail "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 = 2' "$monitor_lua" >/dev/null || fail "monitor scaling up does not persist 3x from 2x"
|
grep -Fx 'local omarchy_monitor_scale = 3' "$monitor_lua" >/dev/null || fail "monitor scaling up persists 3x"
|
||||||
pass "monitor scaling up stops at 2x"
|
pass "monitor scaling up reaches 3x"
|
||||||
|
|
||||||
write_monitor_config
|
write_monitor_config
|
||||||
OMARCHY_TEST_MONITOR_SCALE=3 run_scaling down
|
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=$(OMARCHY_TEST_MONITOR_SCALE=3 run_scaling)
|
||||||
[[ $scale == "3" ]] || fail "monitor scaling reports explicit 3x scale" "actual: $scale"
|
[[ $scale == "3" ]] || fail "monitor scaling reports explicit 3x scale" "actual: $scale"
|
||||||
pass "monitor scaling reports explicit 3x 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"
|
||||||
|
|||||||
Reference in New Issue
Block a user