Hell Unix.com Community:
I am working on a personal project using yad v0.12.4 (zenity fork) and have hit a wall on how to show a progress bar while my function is processing.
I have been all over the ABS Guide, googled 21 Linux-specific sites that I revere. I even asked on the yad-common google group, but I remain stumped. If you don't know yad, think zenity on steroids.
The author suggested "while pkill -0 ec2-describe-snapshots ; do sleep 0.5; echo "qqq" done | yad --progress --pulsate" but I failed to get it working.
The script has 3 variables. 2 of which are in the function and those 2 go out and grab AWS snapshots and gets the count for each client.
Everything works until I try to implement a "--progress" meter while the function is running.
I want a progress meter to be displayed during the ~11 seconds it takes to execute the function. I have been partially successful at times, but my chop and hack method is driving me :wall:
My code can be seen at SUSE Paste
Thank you for your time.
I can't find a manual page for yad, but I see that you're feeding it data into standard input. Animated things like progress bars may not work if the process is talking to anything but a terminal, and a pipe's not a terminal; is there a way to give it data as commandline parameters instead?
Corona688:
That's a really good question, but I have to ponder it further before I reply to it.
Meanwhile, I stuck the contents of the man file at SUSE Paste
for your review.
Thank you,
Edit: the project page is at Google Code Archive - Long-term storage for Google Code Project Hosting. with code snippets etc... that may help you help me.
P.S. There's nothing that prevents me from using a zenity progress meter in my code, if that helps.
Oh, I see. You want yad to happen BEFORE your function finishes.
---------- Post updated at 09:16 PM ---------- Previous update was at 09:12 PM ----------
I don't think you can use a yad progress bar AND have yad accept text input at the same time -- how could it tell the difference between the two? Would a text progressbar do?
You don't see to be using yad for anything but displaying text anyway, so why use yad at all?
---------- Post updated at 09:32 PM ---------- Previous update was at 09:16 PM ----------
you could run a separate instance of yad...
touch /tmp/$$
# echo 1 to start it throbbing
# sleep until the file is deleted, then echo 100 to make it close
# () & to make it run in the background
( ( echo 1 ; while [ -f /tmp/$$ ] ; do sleep 1 ; done ; echo 100 ) | yad --progress --pulsate --auto-close --no-buttons ) &
some_long_command
rm /tmp/$$
wait # for the dialog made earlier to close
1 Like
Corona688:
Perfect solution!!!
it is a thing of beauty.
touch /tmp/$$
( ( echo 1 ; while [ -f /tmp/$$ ] ; do sleep 1 ; done ; echo 100 ) | yad --progress --pulsate --auto-close \
--text="Retrieving Snapshots..." --width=150 --title="") & get_snapshots
rm /tmp/$$
Thank you very much.