Page 3 of 42

Posted: Wed 15 Apr 2015, 06:47
by kjdixo
Combo box retains selection

Code: Select all

#! /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 

Posted: Sun 24 May 2015, 20:34
by slavvo67
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
###########################

Posted: Sun 24 May 2015, 21:39
by mikeb
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

Posted: Mon 25 May 2015, 00:04
by slavvo67
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"

thumbnails

Posted: Tue 26 May 2015, 06:17
by stemsee
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.

Posted: Tue 26 May 2015, 08:37
by Geoffrey
The only way I know of displaying an image from a list, is in a file selector with a preview

Code: Select all

yad --file-selection --add-preview

Posted: Tue 26 May 2015, 09:24
by mikeb
Hmm could the icons box be used in some way...might be messy though as its intended as a launcher dialog for desktop files...

yad --help-icons

mike

Posted: Tue 26 May 2015, 13:13
by stemsee
Thanks Geoffrey

That is better than what I have now.

Posted: Tue 26 May 2015, 13:47
by stemsee
In fact I am getting thumbnails in yad and preview.

Code: Select all

wp=`yad --title "Select Wallpapers" --geometry=400x500 --file-selection --multiple --add-preview` 

Posted: Tue 26 May 2015, 20:21
by Geoffrey
stemsee wrote:In fact I am getting thumbnails in yad and preview.
Yeah, me too now, the thumbnailer was a little slow creating them.

Posted: Sat 06 Jun 2015, 03:57
by slavvo67
Importantly, the above does not work in some older versions of YAD. I think Quirky Unicorn has an old version that would need updating first.

Posted: Sat 06 Jun 2015, 07:16
by smokey01
Two nice things about YAD, it easy to compile and is a single binary so very easy to update.

Posted: Sat 06 Jun 2015, 08:44
by mikeb
I did manage to build YAD for puppy 4.12 and similar but that does not allow the newer features mentioned.... but hardly a reason to not do tarty things with it :)

And yes...a delight to build... nice coding and easy to hack :)

mike

Posted: Sat 06 Jun 2015, 10:55
by rg66
slavvo67 wrote:Importantly, the above does not work in some older versions of YAD. I think Quirky Unicorn has an old version that would need updating first.
Most puppies come with yad-0.12.4, slacko doesn't have it at all. Current is 0.28.1, you can get it here: http://smokey01.com/rg66/X-slacko/pet_p ... 0.28.1.pet, should work in any puppy.

Posted: Sat 06 Jun 2015, 16:56
by slavvo67
Thanks RG66. I have a new version but as you pointed out, not all puppies have YAD and some contain older versions.

One small item that is puzzling me is how to display hidden files / directories in YAD. Had anyone solved this one?

Thanks,

Slavvo67

Posted: Sat 06 Jun 2015, 20:54
by rg66
slavvo67 wrote:One small item that is puzzling me is how to display hidden files / directories in YAD. Had anyone solved this one?

Thanks,

Slavvo67
I did request a "--show-hidden-folders" and he said was going to do it but it never happened. You can do

Code: Select all

 yad --file
right click on the right pane and click "show hidden files".

Posted: Sun 07 Jun 2015, 16:17
by slavvo67
rg66:

Thank you for the right-click tip. I didn't think about something so obvious but sure enough, it works. Not quite the same as programming it in from the beginning but it'll certainly do.

Thanks again,

Slavvo67

Posted: Mon 08 Jun 2015, 02:40
by rg66
I suppose something like this would do:

Code: Select all

yad --file --text="<span color='blue'>To see hidden files, right click and choose 'show hidden files'</span>" --text-align="center" --width="500" --height="400"

Posted: Mon 08 Jun 2015, 09:00
by mikeb
I suppose something like this would do:
good thinking indeed :)

the right click hidden files option seems to be standard gtk2 behaviour but not well known about.

mike

right click hidden files option

Posted: Mon 08 Jun 2015, 14:53
by seaside
Try this.

Create below file and put at " /root/.config/gtk-2.0/gtkfilechooser.ini"

Code: Select all

# /root/.config/gtk-2.0/gtkfilechooser.ini
[Filechooser Settings]
ShowHidden=true
All gtkfilechooser calls should now show hidden files.

Cheers,
s