add image viewer script
This commit is contained in:
parent
b59f851fdc
commit
31c8e4aab0
18
scripts/examples/spmenu_imageviewer.sh
Executable file
18
scripts/examples/spmenu_imageviewer.sh
Executable 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 "$@"
|
Loading…
Reference in a new issue