slitaz-tools diff tazdrop/tazdrop @ rev 939

tazbox: fix subox icon when ~/.local/share/applications is absent; fix working with freegeoip; write full list of icons used; all other files: 2015 and insert blank lines.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Apr 17 07:35:02 2015 +0300 (2015-04-17)
parents c79e656b37a5
children
line diff
     1.1 --- a/tazdrop/tazdrop	Sat Jan 04 14:32:42 2014 +0000
     1.2 +++ b/tazdrop/tazdrop	Fri Apr 17 07:35:02 2015 +0300
     1.3 @@ -4,13 +4,16 @@
     1.4  # or the expanded panel and it will deal with it. Or at least it will
     1.5  # try, since we are in the first stages of the tool.
     1.6  #
     1.7 -# Copyright (C) 2011-2014 SliTaz GNU/linux - BSD License
     1.8 +# Copyright (C) 2011-2015 SliTaz GNU/linux - BSD License
     1.9  #    - Christophe Lincoln <pankso@slitaz.org>
    1.10  #
    1.11 +
    1.12  . /lib/libtaz.sh
    1.13  export TEXTDOMAIN='tazdrop' # i18n
    1.14  
    1.15 +
    1.16  # Follow XDG standards
    1.17 +
    1.18  CONFIG=$HOME/.config/slitaz/tazdrop.conf
    1.19  NOTES=$HOME/.cache/tazdrop.notes
    1.20  
    1.21 @@ -39,7 +42,9 @@
    1.22  	newline
    1.23  }
    1.24  
    1.25 +
    1.26  # Write notes content type to a file
    1.27 +
    1.28  write_drop() {
    1.29  	sed "s/$(echo -en '\r') /\n/g" >> $NOTES << EOT
    1.30  ====[ $(date '+%x %X') ]====
    1.31 @@ -47,7 +52,9 @@
    1.32  EOT
    1.33  }
    1.34  
    1.35 +
    1.36  # Get and install a package from an URL
    1.37 +
    1.38  get_install_pkg() {
    1.39  	tmp=$DOWNLOADS/$$
    1.40  	mkdir -p $tmp
    1.41 @@ -56,7 +63,9 @@
    1.42  	su -c "tazpkg install *.tazpkg && mv *.tazpkg .. && cd .. && rm -rf $tmp"
    1.43  }
    1.44  
    1.45 +
    1.46  # Main GUI function
    1.47 +
    1.48  drop_main() {
    1.49  	yad --geometry="$DROP_SIZE$DROP_GEOM" \
    1.50  		--sticky --on-top --skip-taskbar --undecorated --no-buttons \
    1.51 @@ -66,7 +75,9 @@
    1.52  		--command="$0"
    1.53  }
    1.54  
    1.55 +
    1.56  # Image GUI function
    1.57 +
    1.58  drop_image() {
    1.59  	yad --geometry="$DROP_IMAGE_GEOM" \
    1.60  		--sticky --on-top --skip-taskbar --undecorated --no-buttons \
    1.61 @@ -76,9 +87,11 @@
    1.62  		--command="$0"
    1.63  }
    1.64  
    1.65 +
    1.66  # Notes GUI function
    1.67 +
    1.68  drop_notes() {
    1.69 -	icon=text-editor
    1.70 +	icon='text-editor'
    1.71  	yad --title="$(_ 'Dropped Notes')" --window-icon=$icon \
    1.72  		--width=500 --height=400 --margins=5 \
    1.73  		--image=$icon --image-on-top \
    1.74 @@ -89,9 +102,11 @@
    1.75  		--button="gtk-close:1"
    1.76  }
    1.77  
    1.78 +
    1.79  #
    1.80  # We may have args on cmdline, execute cmd & and exit.
    1.81  #
    1.82 +
    1.83  case "$1" in
    1.84  	--usage|-h|--help)
    1.85  		usage && exit 0 ;;
    1.86 @@ -116,12 +131,14 @@
    1.87  		drop="$1" && continue ;;
    1.88  esac
    1.89  
    1.90 +
    1.91  #
    1.92  # Drag and drop handler, uritype first filetype after.
    1.93  #
    1.94  # Use 'xdg-open' & 'xdg-mime query filetype /path/to/file',
    1.95  # both need xprop (on slitaz we have obxprop from openbox)?
    1.96  #
    1.97 +
    1.98  case "$drop" in
    1.99  	file:///*)
   1.100  		# Handle local files