Add event-driven wallpaper rotation

This commit is contained in:
Gabriel Brown
2026-08-18 15:00:18 -04:00
parent 52818b7290
commit 1c12892252
3 changed files with 160 additions and 4 deletions
@@ -154,6 +154,48 @@ jq -e '.path == "/images/a.jpg" and .mode == "per-monitor"
[[ "$(tail -1 "$command_log")" == 'hyprctl hyprpaper wallpaper HDMI-A-1,/images/b.jpg' ]] \
|| fail 'transaction continued after the failed output'
printf '\n' >"$control"
printf '%s\n' '{}' >"$active_state"
: >"$command_log"
qs_for_harness ipc call wallpaper-service-test seedSlideshow \
' ["/images/a.jpg","/images/b.jpg","/images/c.jpg"]' false >/dev/null
seeded="$(qs_for_harness ipc call wallpaper-service-test status)"
jq -e '.slideshowTimerRunning == true and .slideshowPath == "/images/a.jpg"' \
<<<"$seeded" >/dev/null || fail "multi-image slideshow did not arm: $seeded"
qs_for_harness ipc call wallpaper-service-test advanceSlideshow >/dev/null
advanced="$(wait_idle)"
jq -e '.mode == "slideshow" and .path == "/images/a.jpg"
and .slideshowPath == "/images/b.jpg"
and .activeByOutput == {"DP-2":"/images/b.jpg","HDMI-A-1":"/images/b.jpg"}' \
<<<"$advanced" >/dev/null || fail "automatic advance persisted policy or lost runtime state: $advanced"
printf 'wrong\n' >"$control"
qs_for_harness ipc call wallpaper-service-test advanceSlideshow >/dev/null
automatic_failure="$(wait_idle)"
jq -e '.path == "/images/a.jpg" and .slideshowPath == "/images/b.jpg"
and .slideshowTimerRunning == true
and .lastError == "Hyprpaper did not confirm that background."' \
<<<"$automatic_failure" >/dev/null \
|| fail "failed automatic advance changed runtime policy or stopped normal scheduling: $automatic_failure"
printf '\n' >"$control"
qs_for_harness ipc call wallpaper-service-test seedSlideshow ' ["/images/a.jpg"]' false >/dev/null
single_item="$(qs_for_harness ipc call wallpaper-service-test status)"
jq -e '.slideshowTimerRunning == false' <<<"$single_item" >/dev/null \
|| fail "one-item slideshow armed a repeating timer: $single_item"
qs_for_harness ipc call wallpaper-service-test applySingle /images/a.jpg >/dev/null
wait_idle >/dev/null
printf '%s\n' '{}' >"$active_state"
: >"$command_log"
qs_for_harness ipc call wallpaper-service-test rapidOutputs >/dev/null
sleep 0.6
hotplug="$(wait_idle)"
[[ "$(rg -c '^hyprctl hyprpaper listactive$' "$command_log")" -eq 1 ]] \
|| fail "rapid output changes did not coalesce: $(<"$command_log")"
jq -e '.lastError == "" and .activeByOutput == {"DP-2":"/images/a.jpg","HDMI-A-1":"/images/a.jpg"}' \
<<<"$hotplug" >/dev/null || fail "hotplug reapply was not verified: $hotplug"
if rg -n 'ReferenceError|TypeError|Binding loop|Unable to assign|Cannot assign' "$shell_log"; then
fail 'service harness emitted a QML runtime warning'
fi