Fix wallpaper scan cap exit status

This commit is contained in:
Gabriel Brown
2026-08-20 22:00:26 -04:00
parent c4642919f7
commit a90f6eb357
2 changed files with 21 additions and 2 deletions
@@ -11,4 +11,4 @@ find "$@" -maxdepth 2 -type f \
-printf '%T@ %p\n' 2>/dev/null \
| sort -rn \
| cut -d' ' -f2- \
| head -60
| awk 'NR <= 60'
+20 -1
View File
@@ -4,6 +4,7 @@ set -euo pipefail
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
service="$repo_dir/config/dot/quickshell/services/Wallpaper.qml"
scanner="$repo_dir/config/dot/quickshell/scripts/panama-wallpaper-scan"
fixture="$(mktemp -d /tmp/panama-wallpaper-service.XXXXXX)"
config_home="$fixture/config"
state_home="$fixture/state"
@@ -17,6 +18,8 @@ shell_log="$fixture/quickshell.log"
harness_pid=""
quoted_home="$fixture/home's"
quoted_wallpaper="$quoted_home/Pictures/Wallpapers/quoted.jpg"
bulk_wallpapers="$fixture/bulk-wallpapers"
bulk_segment="wallpaper-root-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
fail() {
printf 'wallpaper service contract: %s\n' "$1" >&2
@@ -48,10 +51,26 @@ cleanup() {
}
trap cleanup EXIT
for _ in $(seq 1 15); do
bulk_wallpapers="$bulk_wallpapers/$bulk_segment"
done
mkdir -p "$config_home/panama" "$state_home" "$test_bin" \
"$quoted_home/Pictures/Wallpapers"
"$quoted_home/Pictures/Wallpapers" "$bulk_wallpapers"
cp -a "$repo_dir/config/dot/quickshell" "$config_path"
printf 'quoted wallpaper\n' >"$quoted_wallpaper"
for index in $(seq 1 401); do
wallpaper="$bulk_wallpapers/wallpaper-$index.jpg"
printf 'bulk wallpaper %s\n' "$index" >"$wallpaper"
touch -d "@$((1700000000 + index))" "$wallpaper"
done
if ! bulk_scan="$("$scanner" "$bulk_wallpapers")"; then
fail 'a normal scan with more than 60 images exited non-zero'
fi
expected_bulk_scan="$(for index in $(seq 401 -1 342); do
printf '%s\n' "$bulk_wallpapers/wallpaper-$index.jpg"
done)"
[[ "$bulk_scan" == "$expected_bulk_scan" ]] \
|| fail "over-cap scan did not emit exactly the newest 60 images: $bulk_scan"
cat >"$config_home/panama/settings.json" <<'JSON'
{
"displays": {