sxiv

sxiv, Simple X Image Viewer is a lightweight and scriptable image viewer written in C.

Installation

Install the sxiv package, or sxiv-gitAUR for the development version.

Usage

Assigning keyboard shortcuts

sxiv supports external key events. First you have to press Ctrl-x to send the next key to the external key-handler. The external key-handler requires an executable file ~/.config/sxiv/exec/key-handler and passes the key combination pressed via argument as well the names of the currently marked images as stdin (or, if none are marked, the currently selected image). An example key-handler is shipped, when installing sxiv: /usr/share/sxiv/exec/key-handler. The example is a great start to customize shortcuts.

$ mkdir -p ~/.config/sxiv/exec/
$ cp /usr/share/sxiv/exec/key-handler ~/.config/sxiv/exec/key-handler

Be sure to mark the script as executable.

In the following example, we will add the bindings Ctrl+d to execute mv filename ~/.trash, to copy the current images' names to the clipboard with , and to set the current wallpaper with nitrogen. Obviously, some commands may only make sense with a single image as an argument, so you may want to revise this to handle cases when those are passed more than one.

Create .trash folder if it does not exist:

$ mkdir ~/.trash
Tip: You may want to use a standards-compliant trashcan (like trash-cli or bashtrashAUR) rather than mv "$2" ~/.trash.

Tips and tricks

Browse through images in directory after opening a single file

sxiv's developer was requested a few times to make his program browse all images in a directory of the filename given as argument (see and ). There are some forks that features the desired behaviour: doronbehar's, qsmodo's and sammoth's.

Alternatively, you can use the official version of and place this script in and call it like this:

$ scriptname a_single_image.jpg

As indicated in the comments of the script, it may be used to have this behavior when opening images from within ranger.

This shell script from starts in thumbnail mode if and only if the passed file argument is a folder:

Showing the image size in the status bar

Place the following executable script in and make sure that you have the package installed:

gollark: There's not even a reactor installed yet.
gollark: I mean, the UV lights and stuff already do that.
gollark: What's a roentgen?
gollark: *digs out reactor chamber*
gollark: What if I stick a lock on the door, is it okay then?

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.