That script doesn't seem to be tied to ranger, it probably should work. Anyway, what I use is below. That script has comments that it's slow, maybe this one is faster (however, it passes all files to sxiv
and lets it figure out which one it supports).
filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm
\ {View in sxiv}
\ play_images %c -Z -q %i &,
And $VIFM/scripts/play_images
is this script:
#!/bin/bash
shopt -s nullglob
if [[ ! -f $1 ]]; then
echo "$0: first argument is not a file" >&2
exit 1
fi
file=$(basename -- "$1")
dir=$(dirname -- "$1")
arr=()
shift
cd -- "$dir"
for i in *; do
[[ -f "$i" ]] || continue
arr+=("$i")
[[ "$i" == "$file" ]] && n=${#arr[@]}
done
exec sxiv -n "$n" "$@" "${arr[@]}"
I think it's source is inknoir (this is a nick name) and that it might be based
on script for mplayer from ArchWiki. I remember doing some changes to it, but
don't remember which changes.