Using Geeqie as a GUI for your scripts

##Who?##
Linux users with basic scripting knowledge.
##Why?##
You’d like to apply a script (or simply a command) to photos in a directory you’re currently browsing with geeqie. E.g convert multiple files to .gif/A4 pdf/33% of the current size, OCR a tiff in Yagf or generate a thumbnail contact sheet in the current geeqie directory etc. .
##How?##
Write a .desktop file that either contains a one-liner shell command or calls an existing script, optionally with the selected file(s) as argument(s).
##Where?##

Geeqie comes with some defaults for the user in

/usr/share/geeqie/applications/
Individual users can store theirs in:
${HOME}/.config/geeqie/applications/

##Details##
You can create these entries via Edit>Preference>Configure Editors…

Here’s an example one-liner that uses imagemagick’s ‘convert’ to requantise a jpg @ 75% quality.
Note:

  1. This example has been truncated. See the attached zip for the full entry (recompressJpeg.desktop).

  2. See the “Name=Convert to Jpeg @ _75% quality” line? Note the underscore in front of the ‘7’. It creates a keyboard shortcut you can use in the right mouse click/context menu.

  3. The %f in the ‘Exec=’ line. That’s a variable for the currently selected file in geeqie. With multiple files selected, geeqie runs the command on each sequentially.

  4. To handle multiple files (with possible spaces in the filenames) as input to a script rather than a command , use %U (i.e URL’s) in your .desktop file. Thus you can access these with “$@” . See ‘jpgResize_v0.3.sh’ in the zip. The input to your script will be:

    file:///tmp/Example/contains oneSpace.jpg file:///tmp/Example/contains two spaces.jpg

  5. Want to prompt the user with a dialog box with sliders and text entry boxes etc.? Use zenity [1 ] (http://www.linux.org/threads/zenity-gui-for-shell-scripts.5567/ “Examples 1”)
    2 3 for GTK or kdialog for KDE etc. in the scripts you call. Check ‘jpgResize_v0.3.sh’ in the zip.
    Unzip these examples into ${HOME}/.config.geeqie/applications and restart geeqie:
    GeeqieDesktopFiles.zip (1.9 KB)
    Please excuse my coding.

Zenity can be installed in debian/ubuntu with:

sudo apt-get install zenity
in arch/manjaro/antergos:
sudo pacman -S zenity
9 Likes

I’ve had the idea for a while to use this to add metadata to xmp files that darktable will understand, but haven’t gotten around to writing them yet!

This is a very neat idea! geeqie is one of my photo tools, mostly for metadata editing, but never thought to use it like this.

I find it so much quicker and easier than opening the heavyweight utilities. I even have a rudimentary crop, where you use the eye dropper to get pixel co-ords (remember them:confused:) and then write them into a dialog box [x1 y1 x2 y2 ].

Sometime this week, I hope to post a few more example .desktop files, including one to use with Pat’s banner script.