Writing a nautilus-sendto extension for calling user defined scripts
Using nautilus-sendto extensions, the nautilus-sendto program allows sending selected objects to various targets, like mail programs, removable devices, bluetooth tools etc. Unfortunately it is not possible to easily add targets to this menu. There are other extensions of Nautilus, namely nautilus-scripts and nautilus-actions that extended Nautilus to user-defined scripts. Now, my favorite photo manager Shotwell, uses the nautilus-sendto program, and due to design decisions to keep the interface simple (understandable!) there is no way to change or add scripts within Shotwell. As a consequence, I decided to write a nautilus-sendto extensions that allows sending the selected objects to user defined scripts. By that, automatically also Shotwell profits from it.
As of today (2013-03-06) the plugin is fully functional and working.
The extension reads in a configuration file listing scripts, and sending the files there. The configuration file uses the ini-file syntax, and all the scripts have to be defined in the scripts group. On selection of the scripts sendto target, a dropdown list of defined scripts is shown. The plugin is based on the removable-devices nautilus-sendto plugin. Currently the following files are read: /etc/sendto-scripts.conf and ~/.config/sendto-scripts.conf (in fact XDG_CONFIG_DIR).
Also, if there is no such config file, the nautilus-sendto program terminates (this will hopefully be fixed soon).
The current source is available at the github project nautilus-sendto-scripts in the branch sendto-scripts.
The code is licensed under GPLv2 or any later version.
There are still many things to do, but it is a start. Quote from my TODO
add dependency check on gkeyfile library if necessary actually call the scripts, not just print to stdout
- do some checks on the scripts parameter?
various config files? stacking? only user config file?
- output of scripts, error handling
If anyone wants to contribute, please go ahead!