YAD, or 'Yet Another Dialog' for GUI Dialogues from Shell Scripts

I have a 3.5" 320x480 touch screen for the Raspberry Pi. I've had it a long time, and it's been my intent for a couple years to turn it into a home automation controller: specifically, controlling MPD and some lights around the house.

A while back I spent several days trying to get my head around creating GUI interfaces to Python programs. It's very complex, and I didn't have the patience for it, so I eventually gave up. Since I'm pretty good with Bash scripts, I thought I'd take another look at Zenity as a possible solution. Zenity allows the creation of basic GUI interactive elements with simple commands. Unfortunately, it doesn't appear to support one element I really wanted: tabs.

Here's Wikipedia's example shell script in Zenity:

if zenity --question --text="Please press a button."
then
    zenity --info --text="You pressed Yes\!"
else
    zenity --error --text="You pressed No\!"
fi

The point isn't the functionality, but the simplicity - particularly compared to Python GUI creation. And this script shows two different dialogues every time it's run - not just one.

Rather by accident, I stumbled across "YAD" aka "Yet Another Dialog." It bears a striking resemblance to Zenity, including many identical command line switches: the man page acknowledges that it's a fork of Zenity. Closer examination (by which I mostly mean "doing Google Image searches") revealed that it could do at least a couple things Zenity seems incapable of: multiple columns of buttons (Zenity seems only able to do one column), Tabs, and "form buttons." The difference with the latter is that the dialogue window remains active after the button is clicked instead of immediately exiting. YAD is also available as a standard package for Fedora, which made it easy to install and experiment.

Re-implementing the above zenity script in yad:

if yad --question --text="Please press a button."
then
    yad --info --text="You pressed OK\!"
else
    yad --error --text="You pressed Cancel\!"
fi

The changes reflect the difference in the default buttons (no longer "Yes/No" but "OK/Cancel" instead), and the --info and --error dialogue windows now have two buttons instead of just one, but the functionality is the same.

This is a start for an introduction to yad. I mean to write more on the subject but cannot promise it. If you're interested, check out https://www.thelinuxrain.com/articles/the-buttons-of-yad for a good introduction, and http://smokey01.com/yad/ for a really thorough examination of all of YAD's functionality with examples throughout.