Fast copy of photos — a solution!

configuring gthumb to run a script after a key pressSo, you have a (big) collection of photo, and you want to rapidly browse trough them and select a subset for further consideration for, for example, printing or editing them. What I would like was that,  while in the image viewer, with a simple key press I could copy the file to another, pre-chosen directory. No asking nor clicking, just a fast  keypress.

I know you can do it with digiKam, my preferred photo manager, by tagging or starring photo, then select and copy them, etc… but the problem is that I have my photos synchronized on different computers, and tags and stars are often specific of just one of them — so just physically copy the photos would be the better solution.

Firstly I tried to write a plugin for Eye of Gnome, the default viewer in my Ubuntu Natty. Unfortunately, following the instruction here did not show anything; I was not able to find instructions on how to create a plugin that really worked, and nothing on how to manage keyboard input. So I tried various other viewers and finally I decided for gThumb. It can add actions associated with key (only the numeric keypad ones, unfortunately) by selecting tools -> personalize… and adding a script there.

I saved the following script in my $HOME/bin/ directory, with name

#! /bin/bash
#  arguments: <full path of the file> <just the file name>
if [[ -f $finaldir/$2 ]];
    zenity --warning --timeout=3 --title="failed COPY  to $finaldir" --text="$2 exists, skipped"
    cp $1 $finaldir
    zenity --info --timeout=1 --title="COPY to $finaldir" --text="$2 copied to $finaldir"

Now you simply add this script to a the “tools -> personalize” widget and associate the command “gthumb_copy_script %F %B“(*) to a key, for example, key “2” on the keypad — which in my laptop correspond to the key K for Kopy. A fast confirmation dialog is shown — I’d really preferred to use notify-send but Ubuntu developer, in their infinite wisdom, decided to ignore the -t argument, cause evidently no one wants notifications for less than 10 seconds…

Now I have a working solution. But the sad end of the story is that, while we have a better desktop in Linux, we are slowly but constantly losing the configurability that it was, once, its main selling point. Sigh…

(*) %F is the full path of the photo, %B just the file name.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>