| Author |
Message |
technosaurus

Joined: 18 May 2008 Posts: 3845
|
Posted: Sun 01 Aug 2010, 14:47 Post subject:
Zenity/Yad and scripts |
|
The zenity project had gone stale until Victor Ananjevsky forked it to add some patches and produce Yet Another Dialog. It no longer depends on deprecated libraries like libglade or gnome-canvas (just gtk2)
Zenity is still used in many *buntu scripts so I compiled Yad and made a symlink for zenity.
Here is a simple example:
| Code: | #! /bin/bash
XTERM="xterm"
# create history file
mkdir -p ${XDG_CACHE_HOME:-$HOME/.cache}/
HISTFILE=${XDG_CACHE_HOME:-$HOME/.cache}/ix-run.history
touch $HISTFILE
# create and run dialog
TITLE="Run command"
TEXT="\nEnter command to execute:\n"
CMD='yad --width=500 --center --window-icon="gtk-execute" --name="${0##*/}" --title="$TITLE" --text="$TEXT" --image="gtk-execute" --entry --editable'
ARGS=$(perl -pe 's/(^.*$)/"\1"/;s/\n/ /' $HISTFILE)
rcmd=$(eval $CMD $ARGS)
[[ -z "$rcmd" ]] && exit 0
# run command
case $rcmd in
http://*|https://*|ftp://*)
xdg-open $rcmd &
;;
mailto://*)
xdg-email $rcmd &
;;
man://*)
eval $XTERM -e "man ${rcmd#man://}" &
;;
telnet*|ssh*)
eval $XTERM -e "$rcmd" &
;;
*)
eval $rcmd &
;;
esac
# add command to history
grep -q -F "$rcmd" $HISTFILE || echo $rcmd >> $HISTFILE
exit 0 |
more examples here:
http://code.google.com/p/yad/w/list
or use an of the many zenity examples
| Description |
this is actually v0.13.0+some svn bugfixes
|

Download |
| Filename |
yad-0.13.0-i486.pet |
| Filesize |
43.36 KB |
| Downloaded |
381 Time(s) |
| Description |
|

Download |
| Filename |
yad-0.3.1-i486.pet |
| Filesize |
25.45 KB |
| Downloaded |
702 Time(s) |
| Description |
screenshot of example |
| Filesize |
14.75 KB |
| Viewed |
4971 Time(s) |

|
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
Last edited by technosaurus on Thu 01 Sep 2011, 16:09; edited 1 time in total
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3845
|
Posted: Sat 30 Oct 2010, 18:52 Post subject:
|
|
new version for wary puppy (with zenity symlink)
| Description |
|

Download |
| Filename |
yad_NLS-0.5.2-i486.pet |
| Filesize |
13.44 KB |
| Downloaded |
522 Time(s) |
| Description |
|

Download |
| Filename |
yad-0.5.2-i486.pet |
| Filesize |
26.62 KB |
| Downloaded |
567 Time(s) |
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
stu90

Joined: 25 Feb 2010 Posts: 1401 Location: England. Dell Inspiron 1501. Dpup
|
Posted: Sun 20 Feb 2011, 08:59 Post subject:
|
|
updated below.
Last edited by stu90 on Mon 21 Feb 2011, 09:05; edited 1 time in total
|
|
Back to top
|
|
 |
stu90

Joined: 25 Feb 2010 Posts: 1401 Location: England. Dell Inspiron 1501. Dpup
|
Posted: Mon 21 Feb 2011, 09:02 Post subject:
|
|
Ok here is a .pet for yad-0.8.1
| Description |
|

Download |
| Filename |
yad-0.8.1-i486.pet |
| Filesize |
38.83 KB |
| Downloaded |
532 Time(s) |
|
|
Back to top
|
|
 |
abushcrafter

Joined: 30 Oct 2009 Posts: 1447 Location: England
|
Posted: Mon 21 Feb 2011, 16:18 Post subject:
|
|
| stu90 wrote: | | Ok here is a .pet for yad-0.8.1 | Compiled in which Puppy version?
_________________ adobe flash is rubbish!
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/
|
|
Back to top
|
|
 |
playdayz

Joined: 25 Apr 2008 Posts: 3705
|
Posted: Mon 21 Feb 2011, 20:09 Post subject:
|
|
stu90, Talk about immediately useful stu90--I just used this in wine to run winetricks with a better ui--and it saved 300KB over zenity. Thanks.
http://www.murga-linux.com/puppy/viewtopic.php?p=497570#497570
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 841
|
Posted: Wed 23 Feb 2011, 11:44 Post subject:
Yad Subject description: Toolbar example |
|
After looking at the Yad documentation, I saw some features that I was looking for in other dialogs and found missing - the ability to select multiple items. So I checked out some of the features and put together a small, scrollable toolbar to create, add, delete, and start favorite programs. When you press "add" it gives you a list of your *.desktop files, where you can select multiple items for your "toolbar" favorites (and the same process in reverse by pressing "delete"). You can size and place the dialog with the --geometry option.
Note that icons only appear for *.desktop files that contain the actual path.
Yad seems to be somewhere between Xdialog and Gtkdialog3, providing several useful features such as forms, multiple selection, notifications and more. I couldn't get the Filelist widget in forms to work in multiple selection mode, but maybe I missed something.
It seems a good tool for constructing useful projects.
Cheers,
s
| Code: |
#!/bin/sh
TOOLBAR="/root/.toolbar"
[ ! -d $TOOLBAR ] && mkdir $TOOLBAR
yad --title="Toolbar (double-click to run)" --center --icons --read-dir="$TOOLBAR" --button="gtk-add:0" --button="gtk-delete:2" --button="gtk-cancel:1"
CHOICE=$?
[ $CHOICE -eq 0 ] && SEL=`ls /usr/share/applications | cut -d. -f1 | yad --separator=" " --height=300 --list --multiple --column="files"` && for i in $SEL;do ln -s /usr/share/applications/$i.desktop $TOOLBAR/$i.desktop; done
[ $CHOICE -eq 1 ] && exit 0
[ $CHOICE -eq 2 ] && DEL=`ls $TOOLBAR | cut -d. -f1 | yad --separator=" " --height=300 --list --multiple --column="files"` && for i in $DEL;do rm -f $TOOLBAR/$i.desktop; done
exec $0
|
| Description |
toolbar for favorites |
| Filesize |
20.07 KB |
| Viewed |
4186 Time(s) |

|
|
|
Back to top
|
|
 |
stu90

Joined: 25 Feb 2010 Posts: 1401 Location: England. Dell Inspiron 1501. Dpup
|
Posted: Wed 23 Feb 2011, 20:59 Post subject:
|
|
abushcrafter:
it was compiled on lucid puppy.
Playdayz:
glad to be of help - i think one could probably get yad even abit smaller if it wasn't a noob like me compiling and leaving in uneeded file.
seaside:
I had a similar idea about yads use as an application launcher.
http://www.murga-linux.com/puppy/viewtopic.php?t=65011
cheers.
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 841
|
Posted: Thu 24 Feb 2011, 14:01 Post subject:
|
|
Stu90,
I downloaded "Pap" and see it makes it's own *.desktop files (instead of reusing the standard puppy's, like my lazy approach). Since "Pap" provides for a customized program name and icon, it makes for a much nicer appearance.
Since most of Puppy's *.desktop icon paths rely on the window manager to find, using "TOOLBAR" would require editing many of the *.desktop files with the full icon path in order to have them appear in the window. (Hmmm. if only there were some way to tap into the icon path)
Regards,
s
|
|
Back to top
|
|
 |
stu90

Joined: 25 Feb 2010 Posts: 1401 Location: England. Dell Inspiron 1501. Dpup
|
Posted: Thu 24 Feb 2011, 15:15 Post subject:
|
|
Hi seaside,
I have updated pap to version 2 (script is in the second post on the PaP thread) you need to create a directory in root called /root/pap and inside that directory a new directory for each panel.
For instance with the example panels that are in the pap v2 script, you would need directories:
/root/pap/pap-app
/root/pap/pap-desktop
/root/pap/pap-setup
/root/pap/pap-system
You can have any number of panels (line 6 of script) as long as they have a corresponding directory of the same name in /root/pap.
Maybe it wold be more straight forward just to package into a pet with several pre defined panels?
I looked at using existing desktop icons but found as you did them to be inconsistent, many missing full icon paths - perhaps PaP Add application could be addapted and used to edit existing desktop files?
cheers.
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 841
|
Posted: Thu 24 Feb 2011, 16:42 Post subject:
|
|
| stu90 wrote: | Hi seaside,
Maybe it wold be more straight forward just to package into a pet with several pre defined panels?
I looked at using existing desktop icons but found as you did them to be inconsistent, many missing full icon paths - perhaps PaP Add application could be addapted and used to edit existing desktop files?
cheers. |
stu90,
One way might be.... to add a button "Add Application From Menus" and then offer a Filelist and text box which loads the selected *.desktop file for editing. The "name" "exec" and "icon" entries could be changed (well, probably not the exec) and then saved as a new "PaP" *.desktop file.
As to pre-populating panels, you'd probably run into path, progams and icon variability among pups.
Regards,
s
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 841
|
Posted: Thu 24 Feb 2011, 23:45 Post subject:
|
|
stu90,
You could slip this code in which would ask for a *.desktop file and then populate the editor. | Code: | addap="/tmp/addap"
panels='pap-app!pap-setup!pap-desktop!pap-system' # single for !
DESK=`ls /usr/share/applications | yad --separator=" " --height=300 --list --column="files"`
for line in /usr/share/applications/$DESK;do
eval `grep -E '^Name|^Icon|^Exec' "$line" | tr " " "_"` # no spaces
done
yad --title "PaP - Add Application " --width=500 --form --separator='|' \
--text " Add new applications to the panels. " \
--field="Panel Choice":CB "$panels" \
--field="Application Name" "$Name" \
--field="Application Icon" "$Icon" \
--field="Application Executable" "$Exec" \
--icons --button="gtk-cancel:1" --button="gtk-ok:2" > $addap
|
Cheers,
s
|
|
Back to top
|
|
 |
stu90

Joined: 25 Feb 2010 Posts: 1401 Location: England. Dell Inspiron 1501. Dpup
|
Posted: Fri 25 Feb 2011, 11:36 Post subject:
|
|
Thanks Seaside, i have added it into update v3 in the other thread.
cheers.
|
|
Back to top
|
|
 |
stu90

Joined: 25 Feb 2010 Posts: 1401 Location: England. Dell Inspiron 1501. Dpup
|
Posted: Wed 09 Mar 2011, 12:57 Post subject:
|
|
update to yad-0.9.0
| Description |
|

Download |
| Filename |
yad-0.9.0-i486.pet |
| Filesize |
34.05 KB |
| Downloaded |
411 Time(s) |
|
|
Back to top
|
|
 |
Makoto

Joined: 03 Sep 2009 Posts: 1407 Location: Out wandering... maybe.
|
Posted: Fri 11 Mar 2011, 18:27 Post subject:
|
|
Does Yad require Puppy 5, more or less, or can it be compiled for Puppy 4? I'm just wondering, because I've seen implications it requires newer versions of certain libs, that just aren't present (and not easily upgradable ones, like perhaps glib) in Puppy 4.
_________________ [ Puppy 4.3.1 JP, Frugal install | 1GB RAM | 1.3GB swap ] * My Pidgin Builds for Puppy 4.3.1
In memory of our beloved American Eskimo puppy (1995-2010) and black Lab puppy (1997-2011).
|
|
Back to top
|
|
 |
|