#!/bin/bash
# sudo chmod +x /scripts/getwalls.sh

cd $(dirname "$0")
url="https://minimalistic-wallpaper.demolab.com/?random"
tempfile="temp"
wallfile="wallpaper.jpg"
curl --location $url --create-dirs -o $tempfile --silent
if [[ $(file --mime-type -b "$tempfile") == image/*g ]];
then
mv $tempfile $wallfile
getpath=$(readlink -f $wallfile)
pcmanfm --set-wallpaper=$getpath
else
echo "The file is not an image!"
rm $tempfile
fi