commit 754b9b072915d198e8f3f68d22b0b18263f6ecb4 parent 5ae56ce2b4673d9c0caac37e04c9113296b483d0 Author: Alex Balgavy <alex@balgavy.eu> Date: Sun, 26 Sep 2021 14:43:08 +0200 imgpreview: prefer catimg, fall back to chafa Diffstat:
M | scripts/imgpreview | | | 9 | +++++++-- |
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/scripts/imgpreview b/scripts/imgpreview @@ -5,8 +5,13 @@ HEIGHT="$2" os=$(uname -s | tr '[:upper:]' '[:lower:]') case "$os" in linux*) - command -v chafa 1>/dev/null 2>&1 || { printf "Please install chafa\n" && exit 1; } - chafa --fill=block --symbols=block -c 256 -s 80x"$HEIGHT" "$1" + if command -v catimg 1>/dev/null 2>&1; then + catimg -H "$HEIGHT" "$1" + elif command -v chafa 1>/dev/null 2>&1; then + chafa --fill=block --symbols=block -c 256 -s 80x"$HEIGHT" "$1" + else + printf "Please install catimg or chafa\n" >&2 && exit 1 + fi ;; darwin*) command -v chafa 1>/dev/null 2>&1 || { printf "Please install chafa\n" && exit 1; }