diff --git a/contrib/util/nautilus/README.md b/contrib/util/nautilus/README.md new file mode 100644 index 0000000..458225d --- /dev/null +++ b/contrib/util/nautilus/README.md @@ -0,0 +1,6 @@ +`firefox-send` is a script for Nautilus/Nemo/Caja (maybe it needs some adaptation for Caja) to send files directly from the file browser, using the contextual menu. + +* Copy the `firefox-send` file to ~/.local/share/nautilus/scripts/firefox-send +* Modify the default options to your use case: host server, download number, retention time. +* Make the file executable (`chmod +x firefox-send`). +* Restart Nautilus/Nemo/Caja. diff --git a/contrib/util/nautilus/firefox-send b/contrib/util/nautilus/firefox-send new file mode 100755 index 0000000..3707bb4 --- /dev/null +++ b/contrib/util/nautilus/firefox-send @@ -0,0 +1,46 @@ +#!/bin/bash + + +#CONSTANTS +#FILEPATH=`echo $NAUTILUS_SCRIPT_SELECTED_URIS | sed 's@file://@@g'` +# Quote the paths +IFS=$'\n' read -d '' -r -a FILEPATH <<< "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" +FFSEND_BIN='/usr/bin/ffsend' +FFSEND_BIN_OPTS="upload --open --copy" +ZENITY='/usr/bin/zenity ' +ZENITY_PROGRESS_OPTIONS='--auto-close --auto-kill' #you can remove this if you like + +#sanity checks +for sanity_check in $FFSEND_BIN "${FILEPATH[@]}" +do + ZENITY_ERROR_SANITY="There is an error, it involved $sanity_check.\n Probably binary or file missing" + if [ ! -e $sanity_check ] + then + #zenity --error --text="$(eval "echo \"$ZENITY_ERROR_SANITY\"")" + zenity --error --text="$ZENITY_ERROR_SANITY" + exit + fi +done + +# Use the following flags automatically from now on +# -I: no interaction +# -f: force +# -y: yes +# -q: quiet +export FFSEND_NO_INTERACT=1 FFSEND_FORCE=1 FFSEND_YES=1 FFSEND_QUIET=1 +export FFSEND_HOST=https://send.boblorange.net +export FFSEND_EXPIRY_TIME=604800 +export FFSEND_DOWNLOAD_LIMIT=5 + +#check whether copying file or directory +if [ ! -f "${FILEPATH[@]}" ]; then + FFSEND_BIN_OPTS="$FFSEND_BIN_OPTS --archive" +fi + +# Upload a file +#zenity --info --text="Ready to send: $FFSEND_BIN $FFSEND_BIN_OPTS ${FILEPATH[@]}" +$FFSEND_BIN $FFSEND_BIN_OPTS "${FILEPATH[@]}" | $($ZENITY --progress --text="sending $(basename $FILEPATH)" --pulsate $ZENITY_PROGRESS_OPTIONS) +#echo -e "$FILEPATH" | xargs -i $FFSEND_BIN $FFSEND_BIN_OPTS {} | $($ZENITY --progress --text="sending $(basename $FILEPATH)" --pulsate $ZENITY_PROGRESS_OPTIONS) + +# Upload a file +#echo -e "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | xargs -i ffsend upload --open --copy {}