if you select an image file in ranger (on its defaults) and hit r, you'll get this:
Code: Select all
0 | sxiv -- "$@"
1 | feh -- "$@"
Code: Select all
mime ^image, has sxiv, X, flag f = sxiv -- "$@"
mime ^image, has feh, X, flag f = feh -- "$@"
The infamous feh is in the repos too. It's hated and loved by many. The problem it has for this use is that it fucking goes full resolution instead of full screen it can be really annoying. z3bra hates it (introducing meh):
meh... what a cool name, huh?I've spit on feh before (see hsetroot. I have effectively some problems with it. Feh is impossible to use. it displays the images in full size, no matter what the window size is. And that's freaking annoying... I just want my image viewer to display an image at the maximum size for the window, and to resize when I change the window size.
That is what meh does. And (almost) nothing more ! Meh take a list of images as arguments, and fits them in its window. Meh can also read a list from stdin. You can then cycle through images using h,j,k,l,left,down,up,right.
When you press <enter>, meh outputs the current image name to stdout. It allows cool stuffs like meh *.jpg | xargs rm to delete the images upon pressing <enter>.
meh is lighter (less dependencies) than sxiv, it's frigging awesome and can be a good replacement for feh (but more on feh later). It's not in the repos, but it's easy to compile. I don't like dealing with lists, so to open an image it's just great (as z3bra stated), but not that good for slideshows or scrolling images IMHO.
To enable it just add this line into ~/.config/ranger/rifle.conf
Code: Select all
mime ^image, has meh, X, flag f = meh -- "$@"
Here the script:
feh-browser
Code: Select all
#!/bin/bash
#nvoke it with the image path, e.g. "/path/to/script %f -F -Z".
#It should open that image in feh and let you browse through other images in the folder in the usual order, i.e. "feh /path/to/dir/*".
# Change the input field separator to avoid problems with spaces.
IFS='
'
# Get the target file, its name, directory, and the other files in the
directory.
_fpath="${1/%\/}"
_fname="$(basename "$_fpath")"
_dpath="$(dirname "$_fpath")"
_flist=($(ls "$_dpath"))
# Determine the index of the target file in the file list array.
_i=0
for _file in "${_flist[@]}"; do
[ "$_file" == "$_fname" ] && break
_i=$(($_i + 1))
done
# Remove the target file from the arguments, leaving any eventual arguments to
# feh.
shift
# Change to the directory and launch feh with the target file as the first
# argument, and the rest of the files in their normal order.
cd "$_dpath"
feh "$@" "${_flist[@]:$_i}" "${_flist[@]:0:$_i}"
To scroll or navigate all the images into a directory (with left/right arrow keys (up/down to zoom), left mouse clicks or mouse scrolling) use this one:
feh-b
Code: Select all
#!/bin/bash
/usr/local/bin/feh-browser %f -F -Z
feh-s
Code: Select all
#!/bin/bash
/usr/local/bin/feh-browser %f -F -Z -x -q -Y -D 3 .
My rifle:
Code: Select all
#-------------------------------------------
# Image Viewing:
#-------------------------------------------
mime ^image, has meh, X, flag f = meh -- "$@"
mime ^image, has feh-b, X, flag f = feh-b -- "$@"
mime ^image, has feh-s, X, flag f = feh-s -- "$@"
mime ^image, has gimp, X, flag f = gimp -- "$@"
ext xcf, X, flag f = gimp -- "$@"