YAD - Tips

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
stemsee

#161 Post by stemsee »

Here s an example of --on-top 'window above other windows always except when full screen video etc'.
Also an example of
--skip-taskbar - The way to close such a window is to click and press Esc key, or use

Code: Select all

 pid=$!
kill $pid
if backgrounded. The option --no-escape means obligatory use of $! or killall yad.

Code: Select all

yad --geometry=100x100 --undecorated --on-top --text="Drag-n-drop directory or files here \nThey will be added to ref list" --no-buttons --skip-taskbar --dnd --cmd echo $1 >> /root/references.txt &

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#162 Post by smokey01 »

stemsee, nice. I prefer not to background it and keep the decorations. This way I can close it without killing the pid or hitting the ESC key. Also the paths in the file are not useful EG: file:///root/bla.txt. I prefer /root/bla.txt but each to his own.

Have a look at this?

Code: Select all

yad --geometry=100x100 --on-top --text="Drag-n-drop directory or files here \nThey will be added to ref list" --no-buttons --skip-taskbar --dnd --cmd echo $1 | sed 's/^.......//' >> /root/references.txt

stemsee

#163 Post by stemsee »

That would have been a better solution. i was trying to find the expression to get rid of 'file://' yesterday!

However for some reason nothing is getting added to the file /root/references.txt with your code as it is! sed 's/^' isn't that to insert?

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#164 Post by smokey01 »

Once you close the dnd gui the files will be written to your file.

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#165 Post by smokey01 »

BTW yad-0.36.0 is out.
https://sourceforge.net/projects/yad-dialog/
The red change I asked for only a few days ago. Victor sure is responsive.

YAD 0.36.0 released

New and changes in this release:
- add --no-selection option to list dialog
- improve --center option
- add spell checking support for text field in form and text-info dialog
- add gtksourceview support to text-info dialog
- fix setting initial value for numeric text entry in entry dialog
- do not close print dialog when preview button is clicked
- add --monitor option to icon dialog
- change default font for text-info and print text files to Monospace
- quote field values for button callback in form dialog

Download link - https://sourceforge.net/projects/yad-di ... urce=files

Supports of spell checking and gtksourceview are disabled by default.
To turn it on add --enable-spell and --enable-sourceview options
to ./configure command line

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

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#166 Post by smokey01 »

Although my YAD help doesn't display as well in a browser as it does in Notecase, I have placed it at http://smokey01.com/yad so you can monitor my progress.

User avatar
rg66
Posts: 1158
Joined: Mon 23 Jul 2012, 05:53
Location: Vancouver, BC Canada / Entebbe, Uganda Africa!?!

#167 Post by rg66 »

smokey01 wrote:Also the paths in the file are not useful EG: file:///root/bla.txt. I prefer /root/bla.txt but each to his own.
I posted about this here: http://www.murga-linux.com/puppy/viewto ... 748#823748
X-slacko-5b1 - X-tahr-2.0 - X-precise-2.4
[url=http://smokey01.com/rg66/]X-series repo[/url]

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#168 Post by smokey01 »

Where do you think I stole the idea from :lol:

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#169 Post by smokey01 »

The --completion command searches the data in the script and matches it against your input. Run the script and type b into the entry box. You will be given a choice of three words beginning with b.

#!/bin/sh
yad --title="--completion" --completion \
--entry="Name:" "" \
"Abba" "Bark" "Bungy Boy" "Billy" "Charlie" "Delta" "Echo" | while read line; do
ENTRY=`echo $line | awk -F',' '{print $1}'`
echo $ENTRY
done

User avatar
Bert
Posts: 1103
Joined: Fri 30 Jun 2006, 20:09

#170 Post by Bert »

Thank you smokey01 for all your work!

Your help/tutorial is quickly becoming the best yad manual available.
[url=http://pupsearch.weebly.com/][img]http://pupsearch.weebly.com/uploads/7/4/6/4/7464374/125791.gif[/img][/url]
[url=https://startpage.com/do/search?q=host%3Awww.murga-linux.com%2F][img]http://i.imgur.com/XJ9Tqc7.png[/img][/url]

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#171 Post by smokey01 »

Thanks Bert.

If you didn't know, you can download the progressive Notecase file here:
http://smokey01.com/yad/yad.ncd.xz

It's still a work in progress with lots more to do.

stemsee

#172 Post by stemsee »

@smokey01
Your notecase document is really good. Concise, informative, easy to navigate: very usable!

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#173 Post by smokey01 »

A little while back MochiMoppel was looking for a simple GUI to find files between two dates and file sizes. For a bit of fun I made this GUI with YAD that uses the find command. Some might find it useful.
You do need yad-0.36.2 to run it. Earlier versions don't work, well not here anyway.

Code: Select all

#!/bin/sh
#Written by smokey01
#05 May 2016

help () {
	yad --window-icon="gtk-find" --center --title="Look4 Help" --text="
 This is a simple little GUI made with 
 YAD to help drive the find command. 
 
 All fields must be populated or the GUI 
 will not return any results.
 
 If you believe you should have received
 results but didn't, try widening the 
 date and or size parameters.
 
 Double click on results to open the file.  
 
 Requires YAD-0.36.2 or later. 
 
 Enjoy. smokey01
 "
}
export -f help

look () {
	loc=${1}
	name=${2}
	startdate=${3}
	enddate=${4}
	startsize=${5}
	endsize=${6}
	find $loc -name "$name" -newermt "$startdate" ! -newermt "$enddate" -size +$startsize"k" ! -size +$endsize"k" | yad --width=600 --height=400 --separator=" " --window-icon="gtk-find" --title "Search Results" --center --column "Files" --list --dclick-action="rox"
}
export -f look

yad --window-icon="gtk-find" --title="Look4 Files" --center --form --separator=" " --date-format="%Y-%m-%d" \
--field="Location:":MDIR "/root" \
--field="Filename:" "*" \
--field="Start Date:":DT "2000-01-01" \
--field="End Date:":DT "2016-12-31" \
--field="Min Size KB:":NUM "0" \
--field="Max Size KB:":NUM "1024" \
--field="Find!gtk-find:BTN" 'bash -c "look %1 %2 %3 %4 %5 %6"' \
--button=gtk-help:'bash -c help' \
--button=gtk-quit:0

stemsee

#174 Post by stemsee »

I compiled yad-0.36.2-i686 but would not compile with html (--enable-html) nor spell (--enable-spell) on my setup.

So the script you posted doesn't work. All my other scripts work with this yad.

Here is the yad I compiled if anyone wants to test.
Attachments
yad-0.36.2-i686.sfs.gz
(196 KiB) Downloaded 187 times

User avatar
Bert
Posts: 1103
Joined: Fri 30 Jun 2006, 20:09

#175 Post by Bert »

smokey01, I had to change the first line "#!/bin/sh" to "#!/bin/bash" to be able to run the script. With the "#!/bin/sh", terminal says:

Code: Select all

./smokey_find: 24: export: Illegal option -f
and the help button gave the bash --help, not your help-function.
Yad-version also 0.36.2.

Nice script!
[url=http://pupsearch.weebly.com/][img]http://pupsearch.weebly.com/uploads/7/4/6/4/7464374/125791.gif[/img][/url]
[url=https://startpage.com/do/search?q=host%3Awww.murga-linux.com%2F][img]http://i.imgur.com/XJ9Tqc7.png[/img][/url]

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#176 Post by smokey01 »

Bert does your sh point to dash and not bash.

I'm using Fatdog-702, what are you and stemsee using?

I'm currently in Fatdog-701, it works but it's not showing icons for find, help and quit buttons otherwise works fine.

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#177 Post by smokey01 »

stemsee wrote:I compiled yad-0.36.2-i686 but would not compile with html (--enable-html) nor spell (--enable-spell) on my setup.

So the script you posted doesn't work. All my other scripts work with this yad.

Here is the yad I compiled if anyone wants to test.
CatDude has just tried your yad binary pulled from your sfs file and it worked fine in slacko-5.7.

I didn't enable html or spell either.

Instead of using a sfs try renaming the old yad in your system and drop the new one in /usr/bin. I have had experiences where sfs files don't overlay current binaries so it may be calling your old yad.

User avatar
Bert
Posts: 1103
Joined: Fri 30 Jun 2006, 20:09

#178 Post by Bert »

smokey01 wrote:Bert does your sh point to dash and not bash.
Yes, you are right!
I'm using Fatdog-702, what are you and stemsee using?
I'm using Lubuntu....
I'm currently in Fatdog-701, it works but it's not showing icons for find, help and quit buttons otherwise works fine.
Here all icons are visible.
[url=http://pupsearch.weebly.com/][img]http://pupsearch.weebly.com/uploads/7/4/6/4/7464374/125791.gif[/img][/url]
[url=https://startpage.com/do/search?q=host%3Awww.murga-linux.com%2F][img]http://i.imgur.com/XJ9Tqc7.png[/img][/url]

stemsee

#179 Post by stemsee »

The problem was copying the script from the web page. The yad gui has escaped lines which had extra spaces, after I removed the spaces and the escapes it worked fine.

yad compiles by default to install to /usr/local/bin

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#180 Post by smokey01 »

stemsee wrote:The problem was copying the script from the web page. The yad gui has escaped lines which had extra spaces, after I removed the spaces and the escapes it worked fine.

yad compiles by default to install to /usr/local/bin
I always compile like:

Code: Select all

./configure --prefix=/usr
make
make install
Cheers

Post Reply