slitaz-tools rev 556 4.1

Add TazDrop - Desktop Drag N' Drop tool also download manager for TazWeb
author Christophe Lincoln <pankso@slitaz.org>
date Sun Apr 17 23:28:22 2011 +0200 (2011-04-17)
parents 17e0116e3572
children 1bb90d610d9c
files Makefile po/tazdrop/tazdrop.pot tazdrop/Makefile tazdrop/README tazdrop/data/tazdrop.desktop tazdrop/tazdrop tazdrop/tazdrop.conf
line diff
     1.1 --- a/Makefile	Sun Apr 17 23:13:46 2011 +0200
     1.2 +++ b/Makefile	Sun Apr 17 23:28:22 2011 +0200
     1.3 @@ -11,11 +11,15 @@
     1.4  
     1.5  # i18n.
     1.6  
     1.7 -tazboxpot:
     1.8 +tazbox-pot:
     1.9  	xgettext -o po/tazbox/tazbox.pot -L Shell \
    1.10  		--package-name="TazBox" ./tazbox/tazbox
    1.11  
    1.12 -pot: tazboxpot
    1.13 +tazdrop-pot:
    1.14 +	xgettext -o po/tazdrop/tazdrop.pot -L Shell \
    1.15 +		--package-name="TazDrop" ./tazdrop/tazdrop
    1.16 +
    1.17 +pot: tazbox-pot tazdrop-pot
    1.18  	@for p in $(TINYUTILS); do \
    1.19  		echo -n "Generating $$p pot file... "; \
    1.20  		xgettext -o po/$$p/$$p.pot -L Shell \
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/po/tazdrop/tazdrop.pot	Sun Apr 17 23:28:22 2011 +0200
     2.3 @@ -0,0 +1,42 @@
     2.4 +# SOME DESCRIPTIVE TITLE.
     2.5 +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
     2.6 +# This file is distributed under the same license as the PACKAGE package.
     2.7 +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
     2.8 +#
     2.9 +#, fuzzy
    2.10 +msgid ""
    2.11 +msgstr ""
    2.12 +"Project-Id-Version: TazDrop\n"
    2.13 +"Report-Msgid-Bugs-To: \n"
    2.14 +"POT-Creation-Date: 2011-04-17 23:25+0200\n"
    2.15 +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    2.16 +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    2.17 +"Language-Team: LANGUAGE <LL@li.org>\n"
    2.18 +"Language: \n"
    2.19 +"MIME-Version: 1.0\n"
    2.20 +"Content-Type: text/plain; charset=CHARSET\n"
    2.21 +"Content-Transfer-Encoding: 8bit\n"
    2.22 +
    2.23 +#: tazdrop/tazdrop:30
    2.24 +msgid "Usage:"
    2.25 +msgstr ""
    2.26 +
    2.27 +#: tazdrop/tazdrop:32
    2.28 +msgid "Options:"
    2.29 +msgstr ""
    2.30 +
    2.31 +#: tazdrop/tazdrop:33
    2.32 +msgid "Display this samll help"
    2.33 +msgstr ""
    2.34 +
    2.35 +#: tazdrop/tazdrop:34
    2.36 +msgid "Display the desktop Drad N' Drop window"
    2.37 +msgstr ""
    2.38 +
    2.39 +#: tazdrop/tazdrop:35
    2.40 +msgid "Display your dropped text notes"
    2.41 +msgstr ""
    2.42 +
    2.43 +#: tazdrop/tazdrop:79
    2.44 +msgid "Edit or clean-up your dropped text notes"
    2.45 +msgstr ""
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tazdrop/Makefile	Sun Apr 17 23:28:22 2011 +0200
     3.3 @@ -0,0 +1,17 @@
     3.4 +# Makefile for TazDrop
     3.5 +#
     3.6 +PREFIX?=/usr
     3.7 +SYSCONFDIR?=/etc/slitaz
     3.8 +
     3.9 +# Installation
    3.10 +
    3.11 +install:
    3.12 +	mkdir -p $(DESTDIR)$(PREFIX)/bin \
    3.13 +		$(DESTDIR)$(PREFIX)/share/locale \
    3.14 +		$(DESTDIR)$(PREFIX)/share/applications \
    3.15 +		$(DESTDIR)$(SYSCONFDIR)
    3.16 +	cp -a tazdrop $(DESTDIR)$(PREFIX)/bin
    3.17 +	cp -a *.conf $(DESTDIR)$(SYSCONFDIR)
    3.18 +	cp -a data/*.desktop $(DESTDIR)$(PREFIX)/share/applications
    3.19 +	cp -a po/mo/* $(DESTDIR)$(PREFIX)/share/locale 2>/dev/null || return 0
    3.20 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tazdrop/README	Sun Apr 17 23:28:22 2011 +0200
     4.3 @@ -0,0 +1,47 @@
     4.4 +SliTaz Drag N' Drop tool
     4.5 +================================================================================
     4.6 +
     4.7 +
     4.8 +TazDrop is as small window wich can run in a corder of screen on as an expanded
     4.9 +panel and let you Drag N' Drop any kind of content and get an action on it.
    4.10 +You drop an URL if it il a site it will open a browser to this location, if
    4.11 +the URL is a file (tarball, iso, PDF, etc) it will downloaded it. It also handle
    4.12 +email addresse, SliTaz Packages (drop one on TazDrop it will install it) and
    4.13 +if you drop a folder it will create an tar.bz2 archive of it. You can even
    4.14 +drop one of it's options, try to drop: --notes
    4.15 +
    4.16 +Note: This tool is sepatated from tazboxes since it's run pemanently and have
    4.17 +quiet a few lines of code.
    4.18 +
    4.19 +
    4.20 +Auto start the DND window
    4.21 +-------------------------
    4.22 +To start TazDrop with your Window manager you have to put thes line in your
    4.23 +autostart script (For Openbox: ~/.config/openbox/autostart.sh)
    4.24 +
    4.25 +# TazDrop Drag N' Drop handler
    4.26 +tazdrop --dnd &
    4.27 +
    4.28 +
    4.29 +Skip task bar in Openbox
    4.30 +------------------------
    4.31 +To not show the apps in the panel (lxpanel, tint2) you must add these
    4.32 +settings to your Openbox rc.xml ater <applications> at the bottom of
    4.33 +the file:
    4.34 +
    4.35 +  <application name="tazdrop">
    4.36 +    <focus>no</focus>
    4.37 +    <skip_taskbar>yes</skip_taskbar>
    4.38 +  </application>
    4.39 +
    4.40 +
    4.41 +Misc notes
    4.42 +----------
    4.43 +
    4.44 +	* Dropped folder will be archived in tar.bz2
    4.45 +	* Text content is wrote to $HOME/.cache/tazdrop.notes
    4.46 +	* Applications are logically configurable as wel as the tool
    4.47 +	  behavour
    4.48 +
    4.49 +
    4.50 +================================================================================
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/tazdrop/data/tazdrop.desktop	Sun Apr 17 23:28:22 2011 +0200
     5.3 @@ -0,0 +1,8 @@
     5.4 +[Desktop Entry]
     5.5 +Encoding=UTF-8
     5.6 +Type=Application
     5.7 +Name=Dropped Notes
     5.8 +Name[fr]=Notes déposées
     5.9 +Icon=slitaz-menu
    5.10 +Exec=tazdrop --notes
    5.11 +Categories=Office;
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/tazdrop/tazdrop	Sun Apr 17 23:28:22 2011 +0200
     6.3 @@ -0,0 +1,186 @@
     6.4 +#!/bin/sh
     6.5 +#
     6.6 +# SliTaz Drag N' Drop tool! Just put whatever you want on the tiny box
     6.7 +# or the expanded panel and it will deal with it. Or at least it will
     6.8 +# try, since we are in the first stage of the tool
     6.9 +#
    6.10 +# Copyright (C) 2011 SliTaz GNU/linux - BSD License
    6.11 +#    - Christophe Lincoln <pankso@slitaz.org>
    6.12 +#
    6.13 +
    6.14 +# Follow XDG standards
    6.15 +CONFIG=$HOME/.config/slitaz/tazdrop.conf
    6.16 +NOTES=$HOME/.cache/tazdrop.notes
    6.17 +
    6.18 +[ ! -f "$CONFIG" ] && cp /etc/slitaz/tazdrop.conf $CONFIG
    6.19 +. $CONFIG
    6.20 +
    6.21 +# Internationalization
    6.22 +. /usr/bin/gettext.sh
    6.23 +TEXTDOMAIN='tazdrop'
    6.24 +export TEXTDOMAIN
    6.25 +
    6.26 +#
    6.27 +# Here are the functions
    6.28 +#
    6.29 +
    6.30 +usage() {
    6.31 +	cat << EOT
    6.32 +
    6.33 +$(gettext "Usage:") $(basename $0) [--option|file|url]
    6.34 +
    6.35 +$(gettext "Options:")
    6.36 +  --usage  $(gettext "Display this samll help")
    6.37 +  --dnd    $(gettext "Display the desktop Drad N' Drop window")
    6.38 +  --notes  $(gettext "Display your dropped text notes")
    6.39 +
    6.40 +EOT
    6.41 +}
    6.42 +
    6.43 +# Write notes content type to a file
    6.44 +write_drop() {
    6.45 +	sed "s/`echo -en '\r'` /\n/g" >> $NOTES << EOT
    6.46 +====
    6.47 +$drop
    6.48 +EOT
    6.49 +}
    6.50 +
    6.51 +# Get and install a package from URL
    6.52 +get_install_pkg() {
    6.53 +	tmp=$DOWNLOADS/$$ 
    6.54 +	mkdir -p $tmp
    6.55 +	$TERMINAL -hold -e "cd $tmp && wget $drop && \
    6.56 +		su -c \"tazpkg install *.tazpkg && mv *.tazpkg .. && \
    6.57 +		cd .. && rm -rf $tmp\"" &
    6.58 +}
    6.59 +
    6.60 +# Main GUI function
    6.61 +drop_main() {
    6.62 +	yad --text "$DROP_TEXT" \
    6.63 +		--geometry="${DROP_SIZE}$DROP_GEOM" \
    6.64 +		--name="tazdrop" \
    6.65 +		--dnd --sticky --on-top \
    6.66 +		--undecorated --no-buttons \
    6.67 +		--command="$0"
    6.68 +}
    6.69 +
    6.70 +# Image GUI function
    6.71 +drop_image() {
    6.72 +	yad --image=$DROP_IMAGE \
    6.73 +		--geometry="$DROP_GEOM" \
    6.74 +		--name="tazdrop" \
    6.75 +		--dnd --sticky --on-top \
    6.76 +		--undecorated --no-buttons \
    6.77 +		--command="$0"
    6.78 +}
    6.79 +
    6.80 +# Notes GUI function
    6.81 +drop_notes() {
    6.82 +	text=$(gettext "Edit or clean-up your dropped text notes")
    6.83 +	yad --text-info --filename=$NOTES  \
    6.84 +		--title="Dropped Notes" --editable \
    6.85 +		--image=text-editor --image-on-top \
    6.86 +		--window-icon=/usr/share/pixmaps/slitaz-menu.png \
    6.87 +		--text="$text" --margins=5 \
    6.88 +		--width=500 --height=400 \
    6.89 +		--button="gtk-remove:2" \
    6.90 +		--button="gtk-save:0" \
    6.91 +		--button="gtk-close:1"
    6.92 +}
    6.93 +
    6.94 +#
    6.95 +# We may have args on cmdline, execute cmd & and exit.
    6.96 +#
    6.97 +case "$1" in
    6.98 +	--usage|--help)
    6.99 +		usage && exit 0 ;;
   6.100 +	--dnd)
   6.101 +		drop_main && exit 0 ;;
   6.102 +	--dnd-image)
   6.103 +		drop_image && exit 0 ;;
   6.104 +	--notes)
   6.105 +		drop_notes > /tmp/notes.$$
   6.106 +		# Deal with --button
   6.107 +		case $? in
   6.108 +			1) continue ;;
   6.109 +			0) mv -f /tmp/notes.$$ $NOTES ;;
   6.110 +			2) echo "" > $NOTES ;;
   6.111 +		esac
   6.112 +		# Clean cache and exit
   6.113 +		rm -f /tmp/notes.$$ && exit 0 ;;
   6.114 +	*)
   6.115 +		[ -z "$1" ] && usage && exit 0
   6.116 +		drop="$1" && continue ;;
   6.117 +esac
   6.118 +
   6.119 +#
   6.120 +# Drag and drop handler, uritype first filetype after.
   6.121 +#
   6.122 +# Use 'xdg-open' & 'xdg-mime query filetype /path/to/file',
   6.123 +# both needs xprop (on slitaz we have obxprop from openbox)?
   6.124 +#
   6.125 +case "$drop" in
   6.126 +	file:///*)
   6.127 +		# Handle local files
   6.128 +		case "$drop" in
   6.129 +			*.png|*.jpg|*.jpeg|*.gif|*.xpm)
   6.130 +				$IMAGE "$drop" & ;;
   6.131 +			*.txt|*.conf|*.css|*.php|*.cgi|*.list|*README*|*TODO| \
   6.132 +			*.diff|*.log|*.js|*.xml|*receipt)
   6.133 +				$EDITOR "$drop" & ;;
   6.134 +			*.pdf)
   6.135 +				$PDF "$drop" & ;;
   6.136 +			*.html)
   6.137 +				$BROWSER "$drop" & ;;
   6.138 +			*.ogg|*.mp3)
   6.139 +				file=${drop#file://}
   6.140 +				$SOUND "$file" & ;;
   6.141 +			*.tazpkg)
   6.142 +				file=${drop#file://}
   6.143 +				dir=$(dirname $file)
   6.144 +				pkg=$(basename $file)
   6.145 +				$TERMINAL -e "su -c \"cd $dir && tazpkg install ${pkg%/}\"" & ;;
   6.146 +			*.desktop)
   6.147 +				# Exec *.desktop file so they can be used in a non
   6.148 +				# Freedesktop environment (Ex: Ob/tint2/emlfm2)
   6.149 +				file=${drop#file://}
   6.150 +				exec=$(fgrep Exec= "$file" | sed s'/Exec=//')
   6.151 +				$exec & ;;
   6.152 +			*)
   6.153 +				# May we have a directory dropped to be tarbalize!
   6.154 +				# Let leave the tarball in the same the directory.
   6.155 +				file=${drop#file://}
   6.156 +				if [ -d "$file" ]; then
   6.157 +					cd $(dirname $file)
   6.158 +					file=$(basename $file)
   6.159 +					tar -c -j -f ${file}.tar.bz2 $file &
   6.160 +				fi
   6.161 +				# Or maybe an executable binary or script
   6.162 +				if [ -x "$file" ]; then
   6.163 +					$file &
   6.164 +				fi
   6.165 +				;;
   6.166 +		esac
   6.167 +		;;
   6.168 +	http://*|https://*|ftp://*)
   6.169 +		# Handle URL by filetype extension
   6.170 +		case "$drop" in
   6.171 +			*.png|*.jpg|*.jpeg|*.gif|*.xpm|*.gz|*.bz2|*.lzma|*.xz| \
   6.172 +			*.zip|*.pdf|*.iso)
   6.173 +				$TERMINAL -e "cd $DOWNLOADS && wget $drop" & ;;
   6.174 +			*.tazpkg)
   6.175 +				get_install_pkg ;;
   6.176 +			*.html|*.php|*.cgi|*.py|*.pl|*/|*[a-zA-Z0-9])
   6.177 +				$BROWSER "$drop" & ;;
   6.178 +		esac
   6.179 +		;;
   6.180 +	*[a-z0-9]@[a-z0-9]*.[a-z]*)
   6.181 +		# Handle email
   6.182 +		exec $EMAIL "$drop" & ;;
   6.183 +	--*)
   6.184 +		usage && exit 0 ;;
   6.185 +	*)
   6.186 +		write_drop ;;
   6.187 +esac
   6.188 +
   6.189 +exit 0
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/tazdrop/tazdrop.conf	Sun Apr 17 23:28:22 2011 +0200
     7.3 @@ -0,0 +1,31 @@
     7.4 +# TazDrop configuration file
     7.5 +#
     7.6 +
     7.7 +# Favorites applications used by TazDrop
     7.8 +TERMINAL="xterm -geometry 80x10+0-24"
     7.9 +
    7.10 +# Files
    7.11 +PDF="epdfview"
    7.12 +EDITOR="geany"
    7.13 +
    7.14 +# Web
    7.15 +BROWSER="tazweb"
    7.16 +EMAIL="sylpheed --compose"
    7.17 +
    7.18 +# Multimedia
    7.19 +IMAGE="viewnior"
    7.20 +SOUND="alsaplayer"
    7.21 +VIDEO="xine-ui"
    7.22 +
    7.23 +# Paths to downloaded files
    7.24 +DOWNLOADS="$HOME/Downloads"
    7.25 +
    7.26 +# TazDrop behavour for --dnd and --dnd-image
    7.27 +DROP_SIZE="120x24"
    7.28 +DROP_GEOM="+0-0"
    7.29 +DROP_TEXT="    Drag N' Drop"
    7.30 +DROP_IMAGE="slitaz-menu"
    7.31 +
    7.32 +# Include your applications.conf to owerwite TazDrop EDITOR
    7.33 +# BROWSER and TERMINAL
    7.34 +#. $HOME/.config/slitaz/applications.conf