Add warning message for kitty image backend for missing imagemagick

This commit is contained in:
BBaoVanC 2021-02-25 19:07:55 -06:00
parent 122bfa73f7
commit 9ed99828f8
No known key found for this signature in database
GPG key ID: 18089E4E3CCF1D3A

View file

@ -23,11 +23,17 @@ echo "Using height $height"
url=$(curl -fsSL "$imgurl" | jq -r ".url")
curl -fsSLo "$tmpfile.jpg" "$url"
if [ "$TERM" = "xterm-kitty" ] && command -v convert > /dev/null 2>&1; then
neofetch --kitty "$tmpfile.jpg"
if [ "$TERM" = "xterm-kitty" ]; then
command -v convert > /dev/null 2>&1 && neofetch --kitty "$tmpfile.jpg" || kitty_imagemagick_warn=true
if [ "$kitty_imagemagick_warn" = "true" ]; then
jp2a --height="$height" "$tmpfile.jpg" > "$tmpfile"
neofetch --source "$tmpfile"
fi
else
jp2a --height="$height" "$tmpfile.jpg" > "$tmpfile"
neofetch --source "$tmpfile"
fi
rm "$tmpfile" "$tmpfile.jpg"
[ "$kitty_imagemagick_warn" = "true" ] && echo "WARN: imagemagick is required for kitty image backend"