Author |
Message |
kjdixo
Joined: 13 Sep 2009 Posts: 159
|
Posted: Tue 31 Mar 2015, 18:35 Post subject:
|
|
Try this ... execute in console mode or copy and paste to a terminal to check the outputs
Code: |
yad --title="Test" --text="Test buttons" --form --field="1" --field="2" --field="3" --field="4" --button="gtk-ok:0" --button="gtk-cancel:1"
|
|
Back to top
|
|
 |
slavvo67
Joined: 12 Oct 2012 Posts: 1593 Location: The other Mr. 305
|
Posted: Tue 31 Mar 2015, 20:45 Post subject:
|
|
Seems to work but the true test will be in a program I'm writing. - Thanks.
Slavvo67
|
Back to top
|
|
 |
mikeb

Joined: 23 Nov 2006 Posts: 11233
|
Posted: Wed 01 Apr 2015, 05:16 Post subject:
|
|
I applied that yad folder chooser to pburn and it works a treat because you can specify the start directory and can specify the size...gtkdialogs choosers tend to be large.
I yadded pburn last year for an excersise... was quite pleased with the result.
Don't ask...its not like the pburn you know and wait for to boot ...I forked from version one to get on the fly audio burning.
Mike
|
Back to top
|
|
 |
slavvo67
Joined: 12 Oct 2012 Posts: 1593 Location: The other Mr. 305
|
Posted: Wed 01 Apr 2015, 11:55 Post subject:
|
|
The choose directory option seems to go through all the subs, as well. I found that a bit strange. For example, listing all pdf files after choosing a directory will list all the pdf's in all the subs, as well. Is it just a user issue again? LOL
|
Back to top
|
|
 |
kjdixo
Joined: 13 Sep 2009 Posts: 159
|
Posted: Mon 06 Apr 2015, 02:49 Post subject:
|
|
Some YAD links
https://groups.google.com/forum/#!forum/yad-common
http://code.google.com/p/yad/w/list
http://danniel-lara.blogspot.com.br/2011/06/apresentando-o-yad-zenity-melhorado.html
|
Back to top
|
|
 |
slavvo67
Joined: 12 Oct 2012 Posts: 1593 Location: The other Mr. 305
|
Posted: Fri 10 Apr 2015, 00:07 Post subject:
|
|
What I was looking for in my above posts was a way to have the OK and Exit buttons actually work in a script. So for those non-pro's like myself, here's a partial to show how I did it.
choice2=$(yad --title='Title1' --text='Travel Items' --form --field='Show:CB' '1.Airline Tickets!2.Cars' --button="Exit:1" --button="OK:0")
ret=$?
if [[ $ret -eq 1 ]]; then
exit 0 # This exits if you hit the exit instead of OK button.
fi
numb777=${choice2:0:2}
# The above takes the first 2 characters like # 1. and allows it to # be a choice in an if .. then statement.
# For example...
if [ $numb777 = '1.' ]
then
echo "Perhaps you should go to Priceline.com"
fi
|
Back to top
|
|
 |
kjdixo
Joined: 13 Sep 2009 Posts: 159
|
Posted: Fri 10 Apr 2015, 04:53 Post subject:
|
|
Thanks.
An excellent example.
It is frustrating and time consuming when there are not many examples available.
Your snippet will be very useful.
Here is YAD being used to selectively display language verb tables in an openbox menu.
This method could be used to display any images.
Clicking on a menu item opens the required image in a yad window.
Verb tables are complex and often need to be referred to.
Open and close and compare any number of images. It is nice and fast.
Code: |
<?xml version="1.0" encoding="utf-8"?>
<openbox_menu xmlns="http://openbox.org/3.4/menu">
<menu id="root-menu" label="MENU 5">
<item label="" icon="/usr/share/icons/Tango/32x32/actions/go-home.png"><action name="Execute"><command>sh -c "cp /root/.config/openbox/menu1.xml /root/.config/openbox/menu.xml && openbox --reconfigure;xdotool mousemove_relative --polar 280 80; xdotool click 3;xdotool mousemove_relative --polar 100 80"</command></action></item>
<item label="XFE" icon="/usr/share/icons/Tango/32x32/apps/file-manager.png"><action name="Execute"><command>xfe</command></action></item>
<item label="dar" icon="/root/.portugal.png"><action name="Execute"><command>yad --button='gtk-quit:1' --title=dar__to-give --image /root/Verbs/ar/dar__to-give.png</command></action></item>
<item label="deitar" icon="/root/.portugal.png"><action name="Execute"><command>yad --button='gtk-quit:1' --title=deitar__to-lay_to-put-(down)_to-put-to-bed_to-throw --image /root/Verbs/ar/deitar__to-lay_to-put-(down)_to-put-to-bed_to-throw.png</command></action></item>
<item label="deixar" icon="/root/.portugal.png"><action name="Execute"><command>yad --button='gtk-quit:1' --title=deixar__to-let_allow_to-leave-(behind) --image /root/Verbs/ar/deixar__to-let_allow_to-leave-(behind).png</command></action></item>
<item label="dizer" icon="/root/.portugal.png"><action name="Execute"><command>yad --button='gtk-quit:1' --title=dizer__to-say_tell --image /root/Verbs/er/dizer__to-say_tell.png</command></action></item>
<item label="estar" icon="/root/.portugal.png"><action name="Execute"><command>yad --button='gtk-quit:1' --title=estar__to-be_temporary --image /root/Verbs/ar/estar__to-be_temporary.png</command></action></item>
<item label="falar" icon="/root/.portugal.png"><action name="Execute"><command>yad --button='gtk-quit:1' --title=falar__to-speak --image /root/Verbs/ar/falar__to-speak.png</command></action></item>
<item label="haver" icon="/root/.portugal.png"><action name="Execute"><command>yad --button='gtk-quit:1' --title=haver__to-be_impersonal__to-have_auxilliary --image /root/Verbs/er/haver__to-be_impersonal__to-have_auxilliary.png</command></action></item>
<item label="ir" icon="/root/.portugal.png"><action name="Execute"><command>yad --button='gtk-quit:1' --title=ir__to-go --image /root/Verbs/ir/ir__to-go.png</command></action></item>
<item label="pedir" icon="/root/.portugal.png"><action name="Execute"><command>yad --button='gtk-quit:1' --title=pedir__to-ask-for_to-beg --image /root/Verbs/ir/pedir__to-ask-for_to-beg.png</command></action></item>
<item label="poder" icon="/root/.portugal.png"><action name="Execute"><command>yad --button='gtk-quit:1' --title=poder__to-be-able_can --image /root/Verbs/er/poder__to-be-able_can.png</command></action></item>
<item label="ser" icon="/root/.portugal.png"><action name="Execute"><command>yad --button='gtk-quit:1' --title=ser__to-be_permanent --image /root/Verbs/er/ser__to-be_permanent.png</command></action></item>
<item label="ter" icon="/root/.portugal.png"><action name="Execute"><command>yad --button='gtk-quit:1' --title=ter__to-have --image /root/Verbs/er/ter__to-have.png</command></action></item>
<item label="trazer" icon="/root/.portugal.png"><action name="Execute"><command>yad --button='gtk-quit:1' --title=trazer__to-bring --image /root/Verbs/er/trazer__to-bring.png</command></action></item>
<item label="ver" icon="/root/.portugal.png"><action name="Execute"><command>yad --button='gtk-quit:1' --title=ver__to-see --image /root/Verbs/er/ver__to-see.png</command></action></item>
<item label="vestir" icon="/root/.portugal.png"><action name="Execute"><command>yad --button='gtk-quit:1' --title=vestir__to-dress_wear_put-on --image /root/Verbs/ir/vestir__to-dress_wear_put-on.png</command></action></item>
</menu>
</openbox_menu>
|
The 'right click multiple menu' is described fully on the lxde forum . . .
xdotool is not an essential requirement, it only enhances operation of the menu.
http://forum.lxde.org/viewtopic.php?f=24&t=31525
Description |
|
Filesize |
52.48 KB |
Viewed |
1405 Time(s) |

|
|
Back to top
|
|
 |
slavvo67
Joined: 12 Oct 2012 Posts: 1593 Location: The other Mr. 305
|
Posted: Fri 10 Apr 2015, 12:51 Post subject:
|
|
Hi kjdixo:
I was just starting to explore the icons so thank you for that. It looks like a lot of work / writing, though. That is the issue with adding a graphic interface, I guess. I'll let you know if I find any shortcuts.
Best,
Slavvo67
|
Back to top
|
|
 |
kjdixo
Joined: 13 Sep 2009 Posts: 159
|
Posted: Sat 11 Apr 2015, 09:52 Post subject:
|
|
Really happy ... got the above 'yad openbox right-click menu - verb tables' and my earlier post's 'Language Learning - Audio Flashcards with YAD' all working on an old ASUS EeePC 2G Surf (the first model with 2GB storage).
I began by installing LXPUP 14:10 and then installed xfe (removed rox and pcmanfm) and did many more minimalist tweaks (installed earlier pmount - from quirky tahr 6.05 and tweaked pmount code to replace 'rox' with 'xfe').
I have left lxde installed for experimentation purposes and I run an openbox session (with feh [wallpaper] and stalonetray) - my choice.
So now I have a very portable, highly configurable 'language laboratory'.
The eeepc has a small screen with speakers placed either side of the screen.
I tweaked xrandr to give me 2000px x 2000px panning mode, so the small screen is not so much of a problem.
Yad is great for speed and minimalism because it will display images and ... play audio (using mpg123) without the need for big programs that take 'vital and agonising milliseconds' to startup.
@slavvo67 "It looks like a lot of work / writing, though"
10% inspiration 90% perspiration . . . as the saying goes.
|
Back to top
|
|
 |
kjdixo
Joined: 13 Sep 2009 Posts: 159
|
Posted: Tue 14 Apr 2015, 07:29 Post subject:
|
|
Very slightly different from previous combo box examples
Code: |
#! /bin/bash
title=$(echo "Select")
combo()
{
choice=$(yad --title="$title" --text='Travel Items' --form --field='Show:CB' '1.Airline Tickets!2.Cars' --button="Exit:1" --button="OK:0")
ret=$?
if [[ $ret -ge 1 ]]; then
exit 0
fi
choice=$(echo $choice | awk 'BEGIN {FS="|" }{print $1}')
echo $choice
title=$(echo "$choice")
}
while true ; do
combo
done
|
|
Back to top
|
|
 |
kjdixo
Joined: 13 Sep 2009 Posts: 159
|
Posted: Wed 15 Apr 2015, 02:47 Post subject:
|
|
Combo box retains selection
Code: |
#! /bin/bash
title=$(echo "Select")
item='1.Airline Tickets!2.Cars!3.Folding Bike!4.Linux Netbook!5.Lightweight Clothes'
combo()
{
choice=$(yad --title="$title" --text='Travel Items' --form --field='Show:CB' "$item" --button="Exit:1" --button="OK:0")
ret=$?
if [[ $ret -ge 1 ]]; then
exit 0
fi
choice=$(echo $choice | awk 'BEGIN {FS="|" }{print $1}')
echo $item
echo $choice
title=$(echo "$choice")
item=$(echo $item | sed "s/$choice"!"//g" | sed "s/"!"$choice//g")
echo $item
item=$choice"!"$item
}
while true ; do
combo
done
|
|
Back to top
|
|
 |
slavvo67
Joined: 12 Oct 2012 Posts: 1593 Location: The other Mr. 305
|
Posted: Sun 24 May 2015, 16:34 Post subject:
|
|
Probably a pretty easy question but how to I have the fsck command run in an open terminal from this script? I can't just pass fsck to YAD because fsck requires possible interaction via terminal.
#!/bin/bash
cd /
choice2=$(yad --title='Drives' --text='Choose Drive Prefix for Possible Defrag' --form --field='Show:CB' '0.Exit!1. SDA!2. SDB!3. SDC!4. SDD!5. SDE!6. SDF!7. SDG!8. SDH' --button="Exit:1" --button="OK:0")
ret=$?
if [[ $ret -eq 1 ]]; then
exit 0
fi
numb666=${choice2:0:2}
if [[ $numb666 = "1." ]]
then
name1="/dev/sda"
elif [[ $numb666 = "2." ]]
then
name1="/dev/sdb"
elif [[ $numb666 = "3." ]]
then
name1="/dev/sdc"
elif [[ $numb666 = "4." ]]
then
name1="/dev/sdd"
elif [[ $numb666 = "5." ]]
then
name1="/dev/sde"
elif [[ $numb666 = "6." ]]
then
name1="/dev/sdf"
elif [[ $numb666 = "7." ]]
then
name1="/dev/sdg"
elif [[ $numb666 = "8." ]]
then
name1="/dev/sdh"
fi
parted $name1 'print'|yad --geometry=900x600 --list --title "Drive Results" --text "Listing Drive Types.." --column "Types" --button="Exit:1" --button="OK:0"
ret=$?
if [[ $ret -eq 1 ]]; then
exit 0
fi
yad --text="Choose a the name of a file to obtain the most recent version:" --button="Exit:1" --button="OK:0"
ret=$?
if [[ $ret -eq 1 ]]; then
exit 0
fi
search555=$(yad --entry --entry-label="Drive to Defrag Enter as sda2" --button="Exit:1" --button="OK:0")
ret=$?
if [[ $ret -eq 1 ]]; then
exit 0
fi
cd /
###########################
fsck "/dev/$search555" -f
###########################
|
Back to top
|
|
 |
mikeb

Joined: 23 Nov 2006 Posts: 11233
|
Posted: Sun 24 May 2015, 17:39 Post subject:
|
|
The -y parameter might help just not sure if it works for all formats...answers yes to all questions.
or the -p = no questions.
mike
|
Back to top
|
|
 |
slavvo67
Joined: 12 Oct 2012 Posts: 1593 Location: The other Mr. 305
|
Posted: Sun 24 May 2015, 20:04 Post subject:
|
|
Hi Mikeb:
I didn't get it at first but the -y did indeed fix the issue.
Good to hear from ya,
Slavvo67
FIXED
#!/bin/bash
# Just a little GUI to defrag partitions -Slavvo67
# Needs YAD and fsck
# fsck takes a while on USB's so wait a bit longer for those.
cd /
choice2=$(yad --title='Drives' --text='Choose Drive Prefix for Possible Defrag' --form --field='Show:CB' '0. Exit!1. SDA!2. SDB!3. SDC!4. SDD!5. SDE!6. SDF!7. SDG!8. SDH' --button="Exit:1" --button="OK:0")
ret=$?
if [[ $ret -eq 1 ]]; then
exit 0
fi
numb666=${choice2:0:2}
if [[ $numb666 = "1." ]]
then
name1="/dev/sda"
elif [[ $numb666 = "2." ]]
then
name1="/dev/sdb"
elif [[ $numb666 = "3." ]]
then
name1="/dev/sdc"
elif [[ $numb666 = "4." ]]
then
name1="/dev/sdd"
elif [[ $numb666 = "5." ]]
then
name1="/dev/sde"
elif [[ $numb666 = "6." ]]
then
name1="/dev/sdf"
elif [[ $numb666 = "7." ]]
then
name1="/dev/sdg"
elif [[ $numb666 = "8." ]]
then
name1="/dev/sdh"
fi
parted $name1 'print'|yad --geometry=900x600 --list --title "Drive Results" --text "Listing Drive Types.." --column "Types" --button="Exit:1" --button="OK:0"
ret=$?
if [[ $ret -eq 1 ]]; then
exit 0
fi
search555=$(yad --entry --entry-label="Drive to Defrag Enter as sda2" --button="Exit:1" --button="OK:0")
ret=$?
if [[ $ret -eq 1 ]]; then
exit 0
fi
cd /
fsck "/dev/$search555" -fy | yad --geometry=900x600 --list --title "Defragging" --text "/dev/$search555" --column "Working..." --button="Exit:1" --button="OK:0"
|
Back to top
|
|
 |
stemsee
Joined: 27 Jun 2013 Posts: 2297 Location: In The Way
|
Posted: Tue 26 May 2015, 02:17 Post subject:
thumbnails Subject description: how to display |
|
How to get yad to display a list of thumbnails from backgrounds directory. I know the --image switch to display one full sized image, but that's all.
|
Back to top
|
|
 |
|