add image viewer script

This commit is contained in:
speedie 2023-03-21 11:38:51 +01:00
parent b59f851fdc
commit 31c8e4aab0

View file

@ -0,0 +1,18 @@
#!/bin/sh
[ ! -f "$1" ] && printf "You must specify an image to view.\n" && exit 1
genlist() {
argc="$(printf "%s\n" "$@" | wc -l)"
for i in $(seq "$argc"); do
arg="$(printf "%s\n" "$@" | sed -n "${i}","${i}"p)"
[ -z "$arg" ] || [ ! -f "$arg" ] && continue
printf "IMG:%s\t%s\n" "$arg" "$arg"
done
}
main() {
genlist "$@" | spmenu --hide-mode --hide-match-count --hide-left-arrow --hide-right-arrow --hide-prompt --hide-cursor --hide-highlighting --image-size 200 --generate-cache
}
main "$@"