aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/wallp.bats26
-rwxr-xr-xwallp8
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
diff --git a/wallp b/wallp
index 21f491b..339b0dc 100755
--- a/wallp
+++ b/wallp
@@ -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 \