forked from Shinonome/dots-hyprland
use different filename if already used by config
This commit is contained in:
@@ -14,11 +14,11 @@ page=$((1 + RANDOM % 1000));
|
|||||||
response=$(curl "https://konachan.net/post.json?tags=rating%3Asafe&limit=1&page=$page")
|
response=$(curl "https://konachan.net/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-0.$ext"
|
downloadPath="$HOME/Pictures/Wallpapers/konachan_random_image.$ext"
|
||||||
counter=0
|
illogicalImpulseConfigPath="$HOME/.config/illogical-impulse/config.json"
|
||||||
while [ -e $downloadPath ]; do
|
currentWallpaperPath=$(jq -r '.background.wallpaperPath' $illogicalImpulseConfigPath)
|
||||||
counter=$((counter + 1))
|
if [ "$downloadPath" == "$currentWallpaperPath" ]; then
|
||||||
downloadPath="$HOME/Pictures/Wallpapers/konachan_random_image-$counter.$ext"
|
downloadPath="$HOME/Pictures/Wallpapers/konachan_random_image-1.$ext"
|
||||||
done
|
fi
|
||||||
curl "$link" -o "$downloadPath"
|
curl "$link" -o "$downloadPath"
|
||||||
"$SCRIPT_DIR/switchwall.sh" --image "$downloadPath"
|
"$SCRIPT_DIR/switchwall.sh" --image "$downloadPath"
|
||||||
|
|||||||
Reference in New Issue
Block a user