Yad at SliTaz and DND handler

208 views
Skip to first unread message

Pankso

unread,
Apr 15, 2011, 6:15:16 PM4/15/11
to yad-common
Hi all,

First off, greate work! I'm testing and playing with Yad for a few
month now and it as beccome the new tool of choice for all SliTaz GNU/
Linux GUi boxes/script that we need. We was using the unmaintained
gtkdialog untill now and have somethinf like 5000 lines of code to
move. We are splitting things in our new CGI web base admin tool and
in Yad scripts taking advantage of all GTK functions.

One thing who was nice with gtkdialog was the ability to build quite
complex GUI mainly using GtkNetbook.

I did a small guideline and example for other SliTaz devs if you want
to have a look and a new packages notifier with your so cool --
notification

http://hg.slitaz.org/slitaz-dev-tools/file/tip/tazyad
http://hg.slitaz.org/tazpkg/raw-file/tip/tazpkg-notify

Our apps are fully gettextized so users can have Yad GUI in there
native language, also to say that no problem to tranlate Yad script
with standard POT files.

That said I have a few small requests and a question (hope I dont miss
somthing already implemented).

* It would be nice to have an --exit or --kill option for
notification
* A way to have a custom icon for button would be sexy
* A way to keep window open even if entry was validate (for a
pemante search box on desktop)

And my question of the day :-) My goal is to use --dnd to have a small
window, with no decoration, no button and who will handle all dropped
stuff. It will site in a corner of the screen and let user dl or open
file, install packages, etc. It will also be a complement to our home
made Web browser wich is 16kb and will stay unbloated. So having a
tiny download manager with Yad would be perfect!

I trid many thing but I'm unable to use --dnd --command=, can't get
and use the DND data var in an embed function or an externel script.
So here is waht I'm doing but would be happy to know if there is a
better way to handle that (this a cleaned example):


#!/bin/sh
#

# Main GUI function
drag_main() {
yad \
--text "Drag" \
--geometry=36x20+0-0 \
--dnd \
--undecorated
}

# Drag and drop handler
drag_main | while read line
do
case "$line" in
file:///*)
echo "FILE: $line" ;;
http://*)
echo "URL: $line" ;;
*)
echo "Drag type not yet handled..." ;;
esac
done

exit 0

Any suggestion will be appreciate,

Regards,
- Christophe

Victor Ananjevsky

unread,
Apr 16, 2011, 3:26:03 AM4/16/11
to yad-c...@googlegroups.com
On Fri, 15 Apr 2011 15:15:16 -0700 (PDT)
Pankso <pan...@gmail.com> wrote:

> Hi all,
>
> First off, greate work! I'm testing and playing with Yad for a few
> month now and it as beccome the new tool of choice for all SliTaz GNU/
> Linux GUi boxes/script that we need. We was using the unmaintained
> gtkdialog untill now and have somethinf like 5000 lines of code to
> move. We are splitting things in our new CGI web base admin tool and
> in Yad scripts taking advantage of all GTK functions.
>
> One thing who was nice with gtkdialog was the ability to build quite
> complex GUI mainly using GtkNetbook.
>
> I did a small guideline and example for other SliTaz devs if you want
> to have a look and a new packages notifier with your so cool --
> notification
>
> http://hg.slitaz.org/slitaz-dev-tools/file/tip/tazyad
> http://hg.slitaz.org/tazpkg/raw-file/tip/tazpkg-notify
>
> Our apps are fully gettextized so users can have Yad GUI in there
> native language, also to say that no problem to tranlate Yad script
> with standard POT files.
>
> That said I have a few small requests and a question (hope I dont miss
> somthing already implemented).
>
> * It would be nice to have an --exit or --kill option for
> notification

just click a middle button on an icon.

> * A way to have a custom icon for button would be sexy
> * A way to keep window open even if entry was validate (for a
> pemante search box on desktop)
>
> And my question of the day :-) My goal is to use --dnd to have a small
> window, with no decoration, no button and who will handle all dropped
> stuff. It will site in a corner of the screen and let user dl or open
> file, install packages, etc. It will also be a complement to our home
> made Web browser wich is 16kb and will stay unbloated. So having a
> tiny download manager with Yad would be perfect!
>
> I trid many thing but I'm unable to use --dnd --command=, can't get
> and use the DND data var in an embed function or an externel script.

yad --dnd --command "yad --text"

this command will show received data in a new yad window.

if you wish to use functions as a commands, export them first.
this is an example of such trick - http://code.google.com/p/yad/wiki/Notes


--
Victor Ananjevsky <anan...@gmail.com>

Pankso

unread,
Apr 16, 2011, 4:24:58 AM4/16/11
to yad-common


Hi,

> >     * It would be nice to have an --exit or --kill option for
> > notification
>
> just click a middle button on an icon.

Thanks!



> > I trid many thing but I'm unable to use --dnd --command=, can't get
> > and use the DND data var in an embed function or an externel script.
>
> yad --dnd --command "yad --text"
>
> this command will show received data in a new yad window.
>
> if you wish to use functions as a commands, export them first.
> this is an example of such trick -http://code.google.com/p/yad/wiki/Notes

I went throught the wiki and no I cant use -f since I'm in a Busybox
environment and -f is bash specific

Yes you command work with Yad ben how to receive data in a SHell
script to be processed.

yad --dnd --command "/path/to/scripts.sh"

I dont get them in $@ ?

Oh and no way to keep a windo open even id it get an event button ?

- Christophe

Victor Ananjevsky

unread,
Apr 16, 2011, 6:13:50 AM4/16/11
to yad-c...@googlegroups.com
On Sat, 16 Apr 2011 01:24:58 -0700 (PDT)
Pankso <pan...@gmail.com> wrote:

>
>
> Hi,
>
> > > О©Ґ О©Ґ * It would be nice to have an --exit or --kill option for

> Delivered-To

example of simple downloader

#! /bin/bash
# FlashGot arguments are: [URL] [REFERER] [POST]

DOWNLOAD_DIR=$HOME/Download
url=$1

case $url in
http*|ftp*)
filename=$(yad --file --save --confirm-overwrite \
--title="Downloader" --text="Select file name" \
--filename $DOWNLOAD_DIR/$(basename $url))
if [[ $? -eq 0 ]]; then
id=$(wget -c -b -o /tmp/wget-$$.log --referer="$2" --post-data="$3" -O "$filename" "$url" | egrep -o "[0-9]+")
tail -f --pid="$id" /tmp/wget-$$.log \
| sed -u -n 's/.*\.[ ]*\([[:print:]]*\)%[ ]*\([[:graph:]]*\) \([[:graph:]]*\)$/#\1% [\2] (\3)\n\1/p' \
| yad --title="Downloader" --no-markup --text "Download $url" --button=gtk-close --progress --percentage=0 --auto-close
rm -f /tmp/wget-$$.log
fi
;;
*)
yad --image=dialog-error --text="URI '$url' is not supported"
exit 1
;;
esac

save this code to $HOME/bin/dload.sh and try

yad --image=gtk-save --no-buttons --sticky --undecorated --geometry=-0-0 --dnd --command="$HOME/bin/dload.sh"

--
Victor Ananjevsky <anan...@gmail.com>

Pankso

unread,
Apr 17, 2011, 11:37:36 AM4/17/11
to yad-common
Hi,

I realy appreciate your help and fast response. Ok so I have my app
working nicely and realy dont know eas I did with my try and $1, since
it working propely.

If you interested here is my code that will be include and on all
SliTaz standar desktops, I dont past it since it 160 lines...

http://people.slitaz.org/~pankso/projects/tazdrop/

I wanted to handle file:// and mails. Dropped folders are tarballized
ans dropped text is wrote to a file and can be displayed with: tazdrop
--notes or by dropping the command --notes on the DND window started
with: tazdrop --dnd

ust now I have only one thing to fix and I'm struggling a bit... my
goal is to skip_taskbar_hint="true" and have it work like a dock apps.
Any suggestion ?

Hugs,
- Christophe

Victor Ananjevsky

unread,
Apr 17, 2011, 1:37:24 PM4/17/11
to yad-c...@googlegroups.com

i'll add such option in a next release. as a workaround you may try to use devilspie (http://live.gnome.org/DevilsPie)

> Hugs,
> Delivered-To

--
Victor Ananjevsky <anan...@gmail.com>

Reply all
Reply to author
Forward
0 new messages