2026-02-27 13:36:56 -05:00
|
|
|
#!/usr/bin/env bash
|
2026-02-27 18:49:38 -05:00
|
|
|
|
2026-02-27 13:36:56 -05:00
|
|
|
file="$1"
|
2026-02-27 18:49:38 -05:00
|
|
|
w="$2" h="$3" x="$4" y="$5"
|
|
|
|
|
|
|
|
|
|
case "$(file -Lb --mime-type "$file")" in
|
|
|
|
|
image/*)
|
2026-02-27 18:56:42 -05:00
|
|
|
# kitten icat --stdin no --transfer-mode memory --place "${w}x${h}@${x}x${y}" "$file" /dev/tty
|
|
|
|
|
kitten icat --stdin no --transfer-mode memory "$file" /dev/tty
|
2026-02-27 18:49:38 -05:00
|
|
|
;;
|
|
|
|
|
application/pdf)
|
|
|
|
|
pdftoppm -f 1 -singlefile "$file" "/tmp/lfoutput"
|
|
|
|
|
kitten icat --stdin no --transfer-mode memory --place "${w}x${h}@${x}x${y}" "/tmp/lfoutput.ppm" /dev/tty
|
2026-02-27 13:36:56 -05:00
|
|
|
;;
|
|
|
|
|
*)
|
2026-02-27 18:49:38 -05:00
|
|
|
less "$file"
|
2026-02-27 13:36:56 -05:00
|
|
|
;;
|
|
|
|
|
esac
|
2026-02-27 18:49:38 -05:00
|
|
|
exit 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#file="$1"
|
|
|
|
|
#case "$file" in
|
|
|
|
|
# *.png|*.jpg|*.jpeg|*.gif|*.bmp|*.tiff|*.webp)
|
|
|
|
|
# # 260227: img2sixel is (currently) not supported by kitty
|
|
|
|
|
# kitty +kitten icat "$file"
|
|
|
|
|
# #img2sixel -w "$(tput cols)" "$file"
|
|
|
|
|
# ;;
|
|
|
|
|
# *)
|
|
|
|
|
# echo "Unsupported image format"
|
|
|
|
|
# exit 1
|
|
|
|
|
# ;;
|
|
|
|
|
#esac
|