Zenity/Yad and scripts

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#21 Post by seaside »

Ok, here's yad-0.9.0. compiled in Pup431. Just extract it to /usr/bin.

Cheers,
s
Attachments
yad.tar.gz
yad-0.9.0. compiled in pup431
(128.59 KiB) Downloaded 1130 times

stu90

#22 Post by stu90 »

Update for yad - 0.9.1 :D
compiled in Lucid puppy.
Attachments
yad-0.9.1-i486.pet
(34.59 KiB) Downloaded 1395 times

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

Bfile

#23 Post by seaside »

I thought it might be interesting to try out some of the functions in yad-0.9.0., so here is "Bfile", a password manager.

Bfile uses Puppy's Bcrypt for encryption.

The first time opened you will be asked for an 8 digit password and when the Bfile program dialog opens, select "edit" and then enter data. When done editing and making sure that all items are highlighted, hit enter or ok. Anything not highlighted will not be saved.

If you select and enter an item in the main dialog, your default browser will open at the chosen URL and the Userid will be put on the clipboard. Locate the logon userid box and just paste. Return to the Bfile dialog, select the same Url item and then click on "PastePW". Next, find the logon password box and paste.

Note: After the data file Bfile.bfe has been created, and you wish to edit the contents, be sure that all items you want kept are highlighted before hitting "enter" or "ok". If you hit "enter" or "ok" and nothing is highlighted, all the data is erased. (Fortunately, a backup file is generated and if renamed from Bfile.bfeBAK to Bfile.bfe, all is recovered) If nothing needs to be changed, you can safely exit "edit" by clicking "cancel". There's no error checking. If you enter the wrong password or no password, an empty dialog is shown.

Code following is mainly a demo of some Yad functions, so don't be in any hurry to give up the Figaro password manager. :D

What would really be nice is a linux program that operated like the Windows program, Roboform, where all the text entry boxes are automatically located and filled in - no matter what the webpage produces......

Cheers,
s

Code: Select all

#!/bin/sh 

# Bfile - Password Manager

editor () {
	
	BLOC=$(for entry in `echo "$PASS1
	$PASS1"| bcrypt -o  /root/Bfile.bfe`; do echo $entry;done |yad --separator=" " --width=500 --height=300 --center --title="Bfile Edit" --image="gtk-edit" --text="Edit-Delete-Add Url locations" --list --editable --multiple --column="Name" --column="Url" --column="UserId" --column="Password" --button="gtk-ok:0" --button="gtk-cancel:1")  
	
	 [[ $? -ne 0 ]] && exit
	 echo "$BLOC" >/tmp/Bfile
	echo "$PASS1
$PASS1"| bcrypt /tmp/Bfile 
	
	mv /root/Bfile.bfe /root/Bfile.bfeBAK
	cp /tmp/Bfile.bfe /root/Bfile.bfe
	
}	


if [ -f /root/Bfile.bfe ]; then

	PASS1=`yad --title="Password" --entry --hide-text --image="gtk-dialog-authentication" --text="enter password"` 
	[[ $? != 0 ]] && exit

else

warning=" "
	
while [ 1 ];do

	PASS=`yad --title="Password" --form --separator=" " --image="gtk-dialog-authentication" --text="$warning" --field="enter password:H" --field="reenter password:H"`
	
	PASS1=`echo $PASS | cut -d" " -f1`
	PASS2=`echo $PASS | cut -d" " -f2`
	
	if [ `expr length $PASS1` -lt 8 ]; then 
		warning="<b><span color='"'orange'"'>Password needs to be at least 8 characters  </span></b>"
		continue
	fi
	
	if [[ "$PASS1" != "$PASS2" ]] ; then
		warning="<b><span color='"'red'"'>Passwords do not match - try again  </span></b>"
		continue
	fi
	
	break
	
done

fi

while true; do
			# Selection dialog
	LOC=$(for entry in `echo "$PASS1
	$PASS1"| bcrypt -o  /root/Bfile.bfe`; do echo $entry;done |yad --separator=" " --width=500 --height=300 --center --on-top --title="Bfile Control" --class="on-top"  --image="gtk-connect" --text="Select Url location" --list --column="Name" --column="Url" --column="UserId" --column="Password" --hide-column=4 --button=" pastePW :4" --button="gtk-edit:2" --button="gtk-ok:0" --button="gtk-cancel:1")  
		# appears that --on-top does not keep dialog on top --class works ok
	ret=$?
	 
	 NAME=`echo $LOC | cut -d" " -f1`
	 URL=`echo $LOC | cut -d" " -f2`
	 USERID=`echo $LOC | cut -d" " -f3`
	 PASSW=`echo $LOC | cut -d" " -f4`
	 echo "$USERID"| xclip
	 
	 [[ $ret -eq 0 ]] && defaultbrowser "$URL" & 
	 
	 [[ $ret -eq 1 || $ret -gt 4 ]] && exit 0
	 
     [[ $ret -eq 2 ]] && editor 
	
     [[ $ret -eq 4 ]] && echo "$PASSW" | xclip

done	
Attachments
bfile.png
Bfile -edit panel
(17.8 KiB) Downloaded 2864 times

stu90

#24 Post by stu90 »

Update: Yad-0.10.0
Compiled on Lucid puppy.
Attachments
yad-0.10.0-i486.pet
(46.86 KiB) Downloaded 723 times

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#25 Post by seaside »

I just noticed that Yad 10.0 now requires a minimum gtk+ version of 2.16.0

Does anyone know how to check what version of gtk+ a pup has?

Cheers,
s

stu90

#26 Post by stu90 »

seaside wrote:I just noticed that Yad 10.0 now requires a minimum gtk+ version of 2.16.0

Does anyone know how to check what version of gtk+ a pup has?

Cheers,
s
Hey seaside,
not sure how you check to see which gtk+ version puppy has?

Yad sure is developed fast another update.
Attachments
yad-0.10.1-i486.pet
(37.04 KiB) Downloaded 1266 times

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#27 Post by vovchik »

Dear Stu,

run this from a terminal to check you gtk+ version:

Code: Select all

pkg-config --modversion gtk+-2.0
With kind regards,
vovchik

PS. You can also look at: /usr/lib/gtk-2.0. Inside you will find a dir with the version no. as part of the name.

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#28 Post by seaside »

vovchik wrote:Dear Stu,

run this from a terminal to check you gtk+ version:

Code: Select all

pkg-config --modversion gtk+-2.0
With kind regards,
vovchik

PS. You can also look at: /usr/lib/gtk-2.0. Inside you will find a dir with the version no. as part of the name.
vovchik,

Thanks for posting that information. I checked both pup 431 and lupu510 and they both have 2.10 according to the folder name.

Regards,
s

stu90

#29 Post by stu90 »

Many thanks vovchik
lucid 525 has version 2.10 also - yad says it requires minimum 2.16.0 but as far as i can tell it still works ?

User avatar
lithpr
Posts: 86
Joined: Thu 10 Mar 2011, 06:33

#30 Post by lithpr »

Here's yad-0.11.0, i opened up stu90's pet to make sure i packaged it the way he did. Of course, if you want to do the honors Stu90, i'll gladly delete this.
Attachments
yad-0.11.0-i486.pet
(38.62 KiB) Downloaded 1075 times

stu90

#31 Post by stu90 »

No probs lithpr - thanks for making .pet
8)

User avatar
lithpr
Posts: 86
Joined: Thu 10 Mar 2011, 06:33

#32 Post by lithpr »

hi all. Finally got around to messing with yad.. it's awesome. So fun and easy to use (at least for the simple case). Here's my first experiment: a little script to help find wallpapers at the users current screen resolution:

Code: Select all

#!/bin/bash
dataline=$(wmctrl -d | grep '*')
width=$(echo "$dataline" | cut -d ' ' -f 5 | cut -d \x -f 1)
height=$(echo "$dataline" | cut -d ' ' -f 5 | cut -d \x -f 2)
search=$(yad \
  --title="Find Wallpapers" \
  --text="This will help you find wallpapers that fit well within your current screen resolution.\n" \
  --window-icon=/usr/share/pixmaps/google-chrome.png \
  --entry --entry-label="Wallpaper Search:")

search=$(echo "$search" | sed "s/ /%20/g")
searchURL="http://images.google.com/images?q=imagesize%3A${width}x${height}+${search}"
defaultbrowser "$searchURL"
I'l definitelyl be messing with it more in the coming weeks.

User avatar
Iguleder
Posts: 2026
Joined: Tue 11 Aug 2009, 09:36
Location: Israel, somewhere in the beautiful desert
Contact:

#33 Post by Iguleder »

Another PET, this time of 0.12.1 :)

Clean install, no extras or patches.
Attachments
yad-0.12.1.pet
(67.89 KiB) Downloaded 1216 times
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

Yad icon browser

#34 Post by vovchik »

Dear lguleder,

Thanks for the new yad pet. I also compiled it (in lucid) and included in my ./configure the option to create the little yad-icon-browser (18k). Here it is. I think it is useful if you are designing gtkdialog/yad/zenity/gtkdialog-splash scripts and want to see what icons you have available that are part of the system.

With kind regards,
vovchik

PS. It installs a menu entry in System.
Attachments
yad-icon-browser-0.12.1.pet
(7.93 KiB) Downloaded 1226 times
yad-icon-browser.jpg
(43.82 KiB) Downloaded 5017 times

stu90

#35 Post by stu90 »

Iguleder wrote:Another PET, this time of 0.12.1 :)

Clean install, no extras or patches.
Thanks for .pet Iguleder 8)

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

#36 Post by L18L »

Iguleder wrote:Another PET, this time of 0.12.1 :)

Clean install, no extras or patches.
latest is 0.12.2 now

stu90

#37 Post by stu90 »

Yad .pet for 0.12.2 compiled on Lucid puppy - nothing stripped out.
Attachments
yad-0.12.2-i486.pet
yad-0.12.2-i486.pet
(70.63 KiB) Downloaded 1371 times

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#38 Post by sc0ttman »

as far as I know, as mentioned before, all puppies seem to say GTK 2.10, but that is only the DEV part of it.. Correct me if I am wrong, but I have 2.10 listed from pkconfig, but am using 2.12.1

I tried to compile Yad on 4.2 and it did say GTK was too old.
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

stu90

#39 Post by stu90 »

sc0ttman wrote:as far as I know, as mentioned before, all puppies seem to say GTK 2.10, but that is only the DEV part of it.. Correct me if I am wrong, but I have 2.10 listed from pkconfig, but am using 2.12.1

I tried to compile Yad on 4.2 and it did say GTK was too old.
Hi sc0ttman,

Does it still compile when you get this message?
I can't recall if i get this message or not as i just bash enter all the way through with out reading the display :lol:

Any idea of what the GTK package would be called? looking though the packages downloaded in woof for squeeze puppy there is a gtk2-engines-pixbuf_2.20.1-2_i386.deb

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

yad

#40 Post by L18L »

stu90 wrote:Yad .pet for 0.12.2 compiled on Lucid puppy - nothing stripped out.
Thanks for compiling.

Here is a code snippet to control required version

Code: Select all

# test of yad version
 yad_version_min_required="0.12.1"
 yad_version=`yad --version`
 yad_version1="`yad --version | cut -d '.' -f 1`"
 yad_version2="`yad --version | cut -d '.' -f 2`"
 yad_version3="`yad --version | cut -d '.' -f 3`"
 #echo $yad_version3
 #echo $yad_version_min_required | cut -d '.' -f 3
 if    [ "$yad_version1" -lt "`echo $yad_version_min_required | cut -d '.' -f 1`" ]; then ver_err=1
 elif [ "$yad_version2" -lt "`echo $yad_version_min_required | cut -d '.' -f 2`" ]; then ver_err=1
 elif [ "$yad_version3" -lt "`echo $yad_version_min_required | cut -d '.' -f 3`" ]; then ver_err=1
 fi
 [ "$ver_err" = "1" ] && printf "your yad version %s is less than the required version %s \n" $yad_version $yad_version_min_required && exit
# /test of yad version
Note, [ "$ver_err" = "1" ] && ......... && exit is ONE line.
Tested succesfully simulating a higher yad_version_min_required

Post Reply