27 lines
405 B
Bash
Executable File
27 lines
405 B
Bash
Executable File
#!/bin/sh
|
|
draw() {
|
|
kitten icat --stdin no --transfer-mode memory \
|
|
--place "${w}x${h}@${x}x${y}" "$1" </dev/null >/dev/tty
|
|
}
|
|
|
|
file="$1"
|
|
w="$2"
|
|
h="$3"
|
|
x="$4"
|
|
y="$5"
|
|
|
|
case "$(file -Lb --mime-type "$file")" in
|
|
image/*)
|
|
draw "$file"
|
|
;;
|
|
application/pdf)
|
|
pdftoppm -f 1 -singlefile "$file" "/tmp/lfoutput"
|
|
draw "/tmp/lfoutput.ppm"
|
|
;;
|
|
*)
|
|
bat --color=always "$1"
|
|
;;
|
|
esac
|
|
|
|
exit 1 # do not cache
|