Welcome to Vifm Q&A, where you can ask questions about Vifm usage. Registration is optional, anonymous posts are moderated. GitHub or Google logins are enabled.

sxiv: scroll through all images

0 votes
asked Mar 1 in vifm by pipppoo

Problem: with the command

filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm
        \ {View in sxiv}
        \ sxiv %f,

the image opens in sxiv, but it's not possible to go to the next image within sxiv.

Does anybody have a script/command with which it is possible to go to the previous/next image without leaving sxiv?

I found this script for ranger, but I can't make it work in vifm.

1 Answer

0 votes
answered Mar 1 by xaizek

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:


shopt -s nullglob

if [[ ! -f $1 ]]; then
    echo "$0: first argument is not a file" >&2
    exit 1

file=$(basename -- "$1")
dir=$(dirname -- "$1")

cd -- "$dir"

for i in *; do
    [[ -f "$i" ]] || continue
    [[ "$i" == "$file" ]] && n=${#arr[@]}

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.

If you would like to make a bug report or feature request consider using GitHub, SourceForge or e-mail. Posting such things here is acceptable, but this is not a perfect place for them.