fix random konachan script not updating wallpaper

This commit is contained in:
Dignity
2025-07-17 20:44:56 +02:00
parent f42e6773aa
commit ccf512b8ad
@@ -14,6 +14,11 @@ page=$((1 + RANDOM % 1000));
response=$(curl "https://konachan.com/post.json?tags=rating%3Asafe&limit=1&page=$page") response=$(curl "https://konachan.com/post.json?tags=rating%3Asafe&limit=1&page=$page")
link=$(echo "$response" | jq '.[0].file_url' -r); link=$(echo "$response" | jq '.[0].file_url' -r);
ext=$(echo "$link" | awk -F. '{print $NF}') ext=$(echo "$link" | awk -F. '{print $NF}')
downloadPath="$HOME/Pictures/Wallpapers/konachan_random_image.$ext" downloadPath="$HOME/Pictures/Wallpapers/konachan_random_image-0.$ext"
counter=0
while [ -e $downloadPath ]; do
counter=$((counter + 1))
downloadPath="$HOME/Pictures/Wallpapers/konachan_random_image-$counter.$ext"
done
curl "$link" -o "$downloadPath" curl "$link" -o "$downloadPath"
"$SCRIPT_DIR/switchwall.sh" --image "$downloadPath" "$SCRIPT_DIR/switchwall.sh" --image "$downloadPath"