From 7777f5c1aa19fa99604857cb5cd13b06453c8cff Mon Sep 17 00:00:00 2001 From: Gabriel Brown Date: Tue, 18 Aug 2026 15:01:49 -0400 Subject: [PATCH] Verify display position restoration --- tests/quickshell/displays-contract.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/quickshell/displays-contract.sh b/tests/quickshell/displays-contract.sh index 46be04c..9bf39bf 100755 --- a/tests/quickshell/displays-contract.sh +++ b/tests/quickshell/displays-contract.sh @@ -170,6 +170,8 @@ original_transform="" original_width="" original_height="" original_refresh="" +original_x="" +original_y="" monitor_name="" monitor_state() { @@ -186,15 +188,18 @@ display_is_restored() { --argjson refresh "$original_refresh" \ --argjson scale "$original_scale" \ --argjson transform "$original_transform" \ + --argjson x "$original_x" \ + --argjson y "$original_y" \ '.width == $width and .height == $height and ((.refreshRate - $refresh) | fabs) < 0.01 and ((.scale - $scale) | fabs) < 0.001 - and .transform == $transform' <<<"$current" >/dev/null + and .transform == $transform + and .x == $x and .y == $y' <<<"$current" >/dev/null } restore_display() { [[ -n "$original_mode" ]] || return 0 - hyprctl eval "hl.monitor({ output = \"$monitor_name\", mode = \"$original_mode\", scale = $original_scale, transform = $original_transform })" >/dev/null \ + hyprctl eval "hl.monitor({ output = \"$monitor_name\", mode = \"$original_mode\", position = \"${original_x}x${original_y}\", scale = $original_scale, transform = $original_transform })" >/dev/null \ || return 1 for _ in $(seq 1 50); do display_is_restored && return 0 @@ -215,8 +220,9 @@ cleanup() { local status=$? trap - EXIT if ! restore_display; then - printf 'displays contract: FAILED to restore %s to %s scale %s transform %s\n' \ - "$monitor_name" "$original_mode" "$original_scale" "$original_transform" >&2 + printf 'displays contract: FAILED to restore %s to %s at %sx%s scale %s transform %s\n' \ + "$monitor_name" "$original_mode" "$original_x" "$original_y" \ + "$original_scale" "$original_transform" >&2 status=1 fi stop_harness @@ -262,6 +268,8 @@ original_height="$(jq -r .height <<<"$state")" original_refresh="$(jq -r .refresh <<<"$state")" original_scale="$(jq -r .scale <<<"$state")" original_transform="$(jq -r .transform <<<"$state")" +original_x="$(jq -r .x <<<"$state")" +original_y="$(jq -r .y <<<"$state")" [[ "$(jq -r .modes <<<"$state")" -gt 0 ]] || fail 'the display reported no usable modes'