27 lines
496 B
Bash
Executable file
27 lines
496 B
Bash
Executable file
#!/bin/sh
|
|
draw() {
|
|
if which kitten > /dev/null ; then
|
|
kitten icat --silent --stdin no --transfer-mode memory --place "${w}x${h}@${x}x${y}" "$1" </dev/null >/dev/tty
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
file="$1"
|
|
w="$2"
|
|
h="$3"
|
|
x="$4"
|
|
y="$5"
|
|
|
|
case "$(file -Lb --mime-type "$file")" in
|
|
image/*)
|
|
draw "$file"
|
|
;;
|
|
video/*)
|
|
# vidthumb is from here:
|
|
# https://raw.githubusercontent.com/duganchen/kitty-pistol-previewer/main/vidthumb
|
|
draw "$($ETC/lf/vidthumb "$file")"
|
|
;;
|
|
esac
|
|
|
|
pistol "$file"
|
|
|