diff --git a/.local/bin/scripts/b b/.local/bin/scripts/b index 346f8cf..b8ac2f5 100755 --- a/.local/bin/scripts/b +++ b/.local/bin/scripts/b @@ -86,13 +86,15 @@ for arg; do case "$(file "$arg")" in (*\ ?udio*) img="$tmpfile.png" + case $TERM in (*-kitty) kitty=true; audioheight=2;; (*) audioheight=5;; esac if which audiowaveform 2>/dev/null >&2 then find "$img" -not -empty 2>/dev/null | grep --quiet . || audiowaveform --quiet --pixels-per-second 2 --height 36 --width 2000 --amplitude-scale auto \ --background-color 000000 --waveform-color 99BBFF --axis-label-color 000000 \ --input-filename "$arg" --output-format png >"$img" && { - timg -g $(tput cols)x2 "$arg" && printf "\\033[2A " - timg -g $(tput cols)x2 --auto-crop --upscale "$img" + test "$kitty" && timg -g x$audioheight "$arg" && + printf "\\033[${audioheight}A%$(expr $audioheight \* 3)s" + timg -g x$audioheight --auto-crop --upscale "$img" } fi timga+=("$arg")