diff options
| author | danix <danix@danix.xyz> | 2026-06-11 10:39:33 +0200 |
|---|---|---|
| committer | danix <danix@danix.xyz> | 2026-06-11 10:39:33 +0200 |
| commit | 363bc738f6fd20dae07faa5453f20477454f4428 (patch) | |
| tree | 60d0bc347bd64610e9ec2bfff03c614766039a72 | |
| parent | 97d910ef1ceb6bb27cb014f6df3ecd688936efe9 (diff) | |
| download | wallp-363bc738f6fd20dae07faa5453f20477454f4428.tar.gz wallp-363bc738f6fd20dae07faa5453f20477454f4428.zip | |
fix: qarma_select returns empty with plain --list
Use --radiolist --print-column=2 so the selected screen value is
actually printed. Plain --list printed nothing on selection, so the
qarma set flow exited without applying. Caught in hardware smoke test.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| -rw-r--r-- | tests/wallp.bats | 26 | ||||
| -rwxr-xr-x | wallp | 8 |
2 files changed, 32 insertions, 2 deletions
diff --git a/tests/wallp.bats b/tests/wallp.bats index d7edaec..e809c13 100644 --- a/tests/wallp.bats +++ b/tests/wallp.bats @@ -238,6 +238,32 @@ teardown() { [[ "$output" == *"no display"* ]] } +@test "set qarma path applies selected screen" { + CONF_OUTPUT_H="DP-1"; CONF_OUTPUT_V="DP-3"; CONF_THEME="conf" + export WAYLAND_DISPLAY="wayland-0" + : > "$HOME/picked.png" + # qarma stub: --list returns the screen choice; --file-selection returns a path. + # Real qarma --list returns the chosen row only with --radiolist and + # --print-column=2; a plain --list prints nothing. The stub mirrors that, so + # this test fails unless qarma_select uses the correct flags. + cat > "$STUB_DIR/qarma" <<EOF +#!/bin/bash +echo "qarma \$*" >> "$TMP_HOME/calls.log" +case "\$*" in + *--list*) + case "\$*" in + *--radiolist*--print-column=2*|*--print-column=2*--radiolist*) echo "V" ;; + esac ;; + *--file-selection*) echo "$HOME/picked.png" ;; +esac +exit 0 +EOF + chmod +x "$STUB_DIR/qarma" + do_set "" + grep -q "swaybg -o DP-3 -i $HOME/picked.png" "$HOME/calls.log" + ! grep -q "swaybg -o DP-1" "$HOME/calls.log" +} + @test "bare invocation shows help" { unset WAYLAND_DISPLAY run main @@ -207,8 +207,12 @@ finalize() { # Interactive selection via qarma. Populates SET_H/SET_V. Isolated for testing. qarma_select() { local choice file - choice="$(qarma --list --title="wallp" --text="Which screen?" \ - --column="Screen" H V Both 2>/dev/null)" || return 1 + # --radiolist + --print-column=2 is required: a plain --list returns nothing + # on selection. Column 1 is the radio bool, column 2 the screen value. + choice="$(qarma --list --radiolist --print-column=2 \ + --title="wallp" --text="Which screen?" \ + --column="Pick" --column="Screen" \ + FALSE H FALSE V FALSE Both 2>/dev/null)" || return 1 case "$choice" in H|Both) file="$(qarma --file-selection --preview-images 500 --width 1300 --height 600 \ |
