From fe63972fba877ba69e079b0fe0e0fc4aa9d795ad Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Wed, 20 Jul 2022 21:06:15 +0100 Subject: [PATCH] bin/b: alternatively use catimg since timg is only in debian testing --- .local/bin/scripts/b | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.local/bin/scripts/b b/.local/bin/scripts/b index 2c5c5e9..951c45d 100755 --- a/.local/bin/scripts/b +++ b/.local/bin/scripts/b @@ -62,6 +62,7 @@ for arg; do fi continue fi + # amount of columns in a grid grid=$(expr $(tput cols) / \( 25 - \( $# / 2 \) \& $# \< 30 \| 5 \)) tmpfile="$prefix/$(basename "$arg")" mkdir -p "$prefix" @@ -135,10 +136,16 @@ done # timga: potentially viewable as image if test "$timg"; then # TODO Don't show info on all images for gifs - $inspect || $elevate timg $(test "$timga" && echo "-V") --rotate=exif -g $(tput cols)x$(expr $(tput lines) / 2) \ - $(test $# -gt 1 && - echo "-t0.2 --center $(test $# -lt 20 && echo "--title") --grid=$((grid < $# ? grid : $#))x2") \ - "${timg[@]}" "${timga[@]}" 2>/dev/null || true + $inspect || + if which timg + then $elevate timg $(test "$timga" && echo "-V") --rotate=exif -g $(tput cols)x$(expr $(tput lines) / 2) \ + $(test $# -gt 1 && + echo "-t0.2 --center $(test $# -lt 20 && echo "--title") --grid=$((grid < $# ? grid : $#))x2") \ + "${timg[@]}" "${timga[@]}" 2>/dev/null || true + else for img in "${timg[@]}" + do catimg -H $(expr $(tput lines) / 2) $img + done + fi if which identify && ( $inspect || test $# -lt 10 ); then tput setaf 6 for img in "${timg[@]}"