topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 1:45 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Yad - Yet Another Dialog  (Read 14827 times)

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,022
    • View Profile
    • Donate to Member
Yad - Yet Another Dialog
« on: May 02, 2014, 09:55 PM »
So, I've used this for quite some time now, and even squawked about it here and there, but I think it deserves a proper Webfind post.  

Display graphical dialogs from shell scripts or command line.
Yad (yet another dialog) is a fork of Zenity with many improvements, such as custom buttons, additional dialogs, pop-up menu in notification icon and more.

Downloads here: http://sourceforge.n...projects/yad-dialog/
Code for above example from the Wiki:
yad --title='Desktop entry editor' --text='Simple desktop entry editor' --form --field='Type:CB' --field='Name' --field='Generic name' --field='Comment' --field='Command:FL' --field='Icon' --field='In terminal:CHK' --field='Startup notify:CHK' 'Application!URI' 'Name' 'Generic name' 'This is the comment' '/usr/bin/yad' 'yad' FALSE TRUE

The Google code site has a lot of example code and a Wiki, whereas the Sourceforge site mainly hosts downloads.

It really is more than just a fork of Zenity, as it has enough flexibility to build basic to moderately-complex dialog-based GUIs for many common command-line functions.  Most of the instructions are pretty intuitive, with a few things here and there that don't seem consistent ('--rest' to read arguments from a text file?) and prepare yourself for a little pain if you need to make something requiring a tray icon...
Other than that, it's truly great.  My applause to Ananasik (Yad lead coder) and all those who have contributed.
 :greenclp:


from an Internet search for "Zenity alternative" or maybe "Autohotkey Linux", I don't remember
« Last Edit: May 02, 2014, 10:35 PM by Edvard »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Yad - Yet Another Dialog
« Reply #1 on: May 03, 2014, 12:36 AM »
Found the following post mentioning yad and others at SO:

  http://stackoverflow.com/a/21408784



FWIW, did find a few examples at sf (may be they're the same as what's at Google code -- looks like they're moving from there):

  http://sourceforge.net/p/yad-dialog/wiki/Examples/

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,022
    • View Profile
    • Donate to Member
Re: Yad - Yet Another Dialog
« Reply #2 on: May 03, 2014, 01:49 AM »
Found the following post mentioning yad and others at SO:
  http://stackoverflow.com/a/21408784

I tried all those mentioned (except KDialog), and Yad was the best of all of them.  To be fair, they're all just graphical notifications, not meant to be full GUIs.  Yad is designed to be more flexible, so by nature it can be used as a GUI construction tool (as long as all you need is a dialog to pass some parameters to command-line tools).

FWIW, did find a few examples at sf (may be they're the same as what's at Google code -- looks like they're moving from there):
  http://sourceforge.net/p/yad-dialog/wiki/Examples/

Hmmm... Yes, it looks like the same content as at the Google Code site.  
Caveat Emptor: I've found most of the examples need a little massaging to work as intended, so keep your Bash skills honed, and the Yad man page handy.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Yad - Yet Another Dialog
« Reply #3 on: May 03, 2014, 05:15 AM »
Thanks for the warning -- the second example didn't work out of the box for me.



I liked the following examples from the man page:

Display a progress dialog while searching for all the postscript files in your home directory

  find $HOME -name '*.ps' | yad --progress --pulsate

Display a box with all of the installed desktop applications

  yad --icons --read-dir=/usr/share/applications

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,022
    • View Profile
    • Donate to Member
Re: Yad - Yet Another Dialog
« Reply #4 on: May 03, 2014, 01:08 PM »
Thanks for the warning -- the second example didn't work out of the box for me.

The run dialog?  Check out the tweaks I posted about that:
http://sourceforge.n...t=25&page=2#7516

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Yad - Yet Another Dialog
« Reply #5 on: May 03, 2014, 04:20 PM »
Thanks -- that runs but I get the following error as well after specifying something to run and clicking the 'OK' button:

run-dialog.sh: line 15: [-z: command not found

For values to execute, I tried 'virtualbox' as well as 'palemoon' with similar results.  To be clearer, both programs start up -- I also see error the 'command not found' result output quoted above.



FWIW, changing line 15 so that there's a space between the first character '[' and the second character '-' seemed to silence the error output.

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,022
    • View Profile
    • Donate to Member
Re: Yad - Yet Another Dialog
« Reply #6 on: May 03, 2014, 04:52 PM »
Ah, yes, I was about to point that out, "[" is an alias for the "test" command that requires a closing "]" and so requires a space between it and it's argument.
Check it out: "man [" brings up the man page for "test", so:
if test -e /usr/bin/man; then echo "yes"; fi
is the same as:
if [ -e /usr/bin/man ]; then echo "yes"; fi

That same error has totally boggled me a few times in the past, and I swore I would never repeat it.   :wallbash:
« Last Edit: May 03, 2014, 04:59 PM by Edvard »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Yad - Yet Another Dialog
« Reply #7 on: May 03, 2014, 06:17 PM »
Ah, yes, I was about to point that out, "[" is an alias for the "test" command that requires a closing "]" and so requires a space between it and it's argument.

Those sneaky *NIX wizards!