add support for Ayatana indicator to Notification plugin
[claws.git] / tools / nautilus2claws-mail.sh
blob4fd0357bafd34b06e9a6f468c11ad70f71143f01
1 #!/usr/bin/env bash
3 # nautilus2claws-mail.sh
4 # Copyright 2004 Reza Pakdel <hrpakdel@cpsc.ucalgary.ca>
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 3
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 # 02111-1307, USA.
21 # This script will recursively attach a number of selected
22 # files/directories from Nautilus to a new blank e-mail.
24 # Authors: Reza Pakdel <hrpakdel@cpsc.ucalgary.ca>
25 # Stephan Sachse <white@teg-clan.de>
27 # Fixes:
28 # Stephan Sachse : files/directorys with whitspaces
31 SELECTED_PATHS="${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS}"
32 NB_SELECTED_PATHS=`echo -n "${SELECTED_PATHS}" | wc -l | awk '{print $1}'`
34 ATTACHMENTS=""
36 for ((i=${NB_SELECTED_PATHS}; i>0; i--)) ; do
37 CURRENT_PATH=`echo -n "${SELECTED_PATHS}" | head -n${i} | tail -n1`
38 if test -d "${CURRENT_PATH}" ; then
39 FILES_FOUND=`find "${CURRENT_PATH}" -type f`
40 NB_FILES_FOUND=`echo "${FILES_FOUND}" | wc -l | awk '{print $1}'`
41 for ((j=${NB_FILES_FOUND}; j>0; j--)) ; do
42 CURRENT_FILE=`echo "${FILES_FOUND}" | head -n${j} | tail -n1`
43 ATTACHMENTS="${ATTACHMENTS} \"${CURRENT_FILE}\""
44 done
45 else
46 ATTACHMENTS="${ATTACHMENTS} \"${CURRENT_PATH}\""
48 done
50 echo "-----------"
51 echo ${ATTACHMENTS}
53 eval "claws-mail --compose --attach ${ATTACHMENTS}"