single notification for wallpaper changes
This commit is contained in:
parent
df80976410
commit
8981800f71
2 changed files with 6 additions and 6 deletions
|
@ -20,4 +20,4 @@ swww query || swww init
|
||||||
convert "$(random_paper)" /tmp/wallpaper.jpg && swww img --transition-step 2 --transition-type random --transition-duration 1 "/tmp/wallpaper.jpg"
|
convert "$(random_paper)" /tmp/wallpaper.jpg && swww img --transition-step 2 --transition-type random --transition-duration 1 "/tmp/wallpaper.jpg"
|
||||||
convert "$(random_paper)" /tmp/lockpaper.jpg
|
convert "$(random_paper)" /tmp/lockpaper.jpg
|
||||||
|
|
||||||
notify-send -r 9897 -i information -t 1000 "Wallpaper" "Wallpaper changed."
|
notify-send -r 1234 -i information -t 5000 "Wallpaper" "Wallpaper changed."
|
||||||
|
|
|
@ -67,13 +67,13 @@ if [ -n "${RANGE}" ]; then
|
||||||
RANGE="topRange=${RANGE}&"
|
RANGE="topRange=${RANGE}&"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
notify-send -u normal -a Wallpapers -i information -t 5000 "Wallpapers" "Fetching a list of wallpapers..."
|
notify-send -r 1234 -u normal -a Wallpapers -i information -t 5000 "Wallpapers" "Fetching a list of wallpapers..."
|
||||||
URL="${WALLHAVEN_BASE_URL}/search?${TAGS}${CATEGORIES}${PURITY}${SIZE}${RATIOS}${COLORS}${AI_FILTER}${SORTING}${RANGE}"
|
URL="${WALLHAVEN_BASE_URL}/search?${TAGS}${CATEGORIES}${PURITY}${SIZE}${RATIOS}${COLORS}${AI_FILTER}${SORTING}${RANGE}"
|
||||||
CURL_CMD="${CURL_BASE_CMD} \"${URL}\""
|
CURL_CMD="${CURL_BASE_CMD} \"${URL}\""
|
||||||
RESULT="$(eval ${CURL_CMD})"
|
RESULT="$(eval ${CURL_CMD})"
|
||||||
NO_OF_IMAGES="$(echo "${RESULT}" | jq -r '.meta.total')"
|
NO_OF_IMAGES="$(echo "${RESULT}" | jq -r '.meta.total')"
|
||||||
if [ "${NO_OF_IMAGES}" -eq 0 ]; then
|
if [ "${NO_OF_IMAGES}" -eq 0 ]; then
|
||||||
notify-send -u normal -a Wallpapers -i information -t 5000 "Wallpapers" "No images available for current configuration."
|
notify-send -r 1234 -u normal -a Wallpapers -i information -t 5000 "Wallpapers" "No images available for current configuration."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
RANDOM_ITEM="$(shuf -i 0-$((NO_OF_IMAGES-1)) -n 1 --random-source=/dev/urandom)"
|
RANDOM_ITEM="$(shuf -i 0-$((NO_OF_IMAGES-1)) -n 1 --random-source=/dev/urandom)"
|
||||||
|
@ -88,11 +88,11 @@ if [ "${ITEM_PAGE}" -gt 0 ]; then
|
||||||
RESULT="$(eval ${CURL_CMD})"
|
RESULT="$(eval ${CURL_CMD})"
|
||||||
fi
|
fi
|
||||||
ID="$(echo "${RESULT}" | jq -r ".data[${ITEM_NUMBER}].id")"
|
ID="$(echo "${RESULT}" | jq -r ".data[${ITEM_NUMBER}].id")"
|
||||||
notify-send -u normal -a Wallpapers -i information -t 5000 "Wallpapers" "Got ${NO_OF_IMAGES} images. Using image ${ID} from page $((ITEM_PAGE+1)) ..."
|
notify-send -r 1234 -u normal -a Wallpapers -i information -t 5000 "Wallpapers" "Got ${NO_OF_IMAGES} images. Using image ${ID} from page $((ITEM_PAGE+1)) ..."
|
||||||
IMAGE_URL="$(echo "${RESULT}" | jq -r ".data[${ITEM_NUMBER}].path")"
|
IMAGE_URL="$(echo "${RESULT}" | jq -r ".data[${ITEM_NUMBER}].path")"
|
||||||
FILENAME="${IMAGE_URL##*/}"
|
FILENAME="${IMAGE_URL##*/}"
|
||||||
notify-send -u normal -a Wallpapers -i information -t 5000 "Wallpapers" "Downloading image: ${IMAGE_URL}"
|
notify-send -r 1234 -u normal -a Wallpapers -i information -t 5000 "Wallpapers" "Downloading image: ${IMAGE_URL}"
|
||||||
curl --silent -L --output-dir "${DIR}" -o "${FILENAME}" "${IMAGE_URL}"
|
curl --silent -L --output-dir "${DIR}" -o "${FILENAME}" "${IMAGE_URL}"
|
||||||
notify-send -u normal -a Wallpapers -i information -t 5000 "Wallpapers" "Downloaded image: ${DIR}/${FILENAME}"
|
notify-send -r 1234 -u normal -a Wallpapers -i information -t 5000 "Wallpapers" "Downloaded image: ${DIR}/${FILENAME}"
|
||||||
echo "${DIR}/${FILENAME}"
|
echo "${DIR}/${FILENAME}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue