Sxiv

From ArchWiki
Revision as of 04:48, 20 June 2011 by Awayand (Talk | contribs) (Created page with "Category: ??? <!-- {{i18n|sxiv}} --> {{Article summary start}} {{Article summary text|sxiv is a lightweight image viewer that is scriptable}} {{Article summary end}} == What...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Template:Article summary start Template:Article summary text Template:Article summary end

What is sxiv

sxiv is a lightweight image viewer written in C that is very lightweight.

Assigning keyboard shortcuts to sxiv

sxiv is scriptable, but to do this, you have to edit config.h and compile sxiv as follows:

As an example we will assign the following command to the key "d": "mv file ~/.trash"

So when sxiv is started in thumbnail mode on a folder, one can see all files in that folder, select random thumbnails, and hit "d" to move them to a custom "trash" folder.

How to make this work:

get latest PKGBUILD from abs: [code]# abs community/sxiv[/code] (notice how the prompt above is a root prompt denoted by a pound-sign (#), so you may have to use sudo for example)

copy source to your own workspace: [code]$ cp -r /var/abs/community/sxiv ~/sources[/code]

move to source directory to start the work: [code]$ cd ~/sources/sxiv[/code]

enable scripting in config.h: [code]/* enable external commands (defined below)? 0=off, 1=on: */

  1. define EXT_COMMANDS 1

[/code]

edit config.h, to add the line for the "d" shortcut: [code]static const command_t commands[] = {

   /* ctrl-...     reload?  command, '#' is replaced by filename */
   {  XK_comma,    True,    "jpegtran -rotate 270 -copy all -outfile # #" },
   {  XK_period,   True,    "jpegtran -rotate 90 -copy all -outfile # #" },
   {  XK_less,     True,    "mogrify -rotate -90 #" },

//insert the line below

   {  XK_d,     True,    "mv # ~/.trash" },
   {  XK_greater,  True,    "mogrify -rotate +90 #" }

};[/code]

Did you notice the line was added before the last one so that one does not have to mess with the commas. Otherwise, if you put this line at the end of the list, you would have had to add a comma above and then probably delete the comma of the copied line...

After saving config.h, create new checksums for modified files (config.h in this case): [code]$ makepkg -g >> PKGBUILD[/code]

Compile sxiv and install it: [code]$ makepkg -efi[/code]

Create .trash folder if it doesn't exist: [code]$ mkdir ~/.trash[/code]

Now when you start sxiv in thumbnail mode on a folder of pictures, i.e.: [code]$ sxiv -tsr ~/pictures[/code]

you can delete selected pictures by hitting "CTRL+d". This will move your selected pic to ~/.trash