commit aa4a783ea7a2273847b8550144ab998606d67131 parent 286d99a02de4faf9ee58189bebbe37c34180466d Author: Alex Balgavy <alex@balgavy.eu> Date: Sun, 2 May 2021 12:18:56 +0200 imgpreview: also use chafa on linux Diffstat:
M | scripts/imgpreview | | | 9 | +++++---- |
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/scripts/imgpreview b/scripts/imgpreview @@ -1,14 +1,15 @@ #!/bin/sh -WIDTH="$2" -[ -z "$2" ] && WIDTH="$(tput cols)" +HEIGHT="$2" +[ -z "$2" ] && HEIGHT="$(tput lines)" os=$(uname -s | tr '[:upper:]' '[:lower:]') case "$os" in linux*) - printf "Haven't chosen a previewer for Linux yet.\n" + 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" ;; darwin*) command -v chafa 1>/dev/null 2>&1 || { printf "Please install chafa\n" && exit 1; } - chafa -c 256 -s 80x"$WIDTH" "$1" + chafa -c 256 -s 80x"$HEIGHT" "$1" ;; msys*|cygwin*|mingw*|nt|win*) printf "Windows not supported.\n"