Creating a Graphical User Interface with yad
Yet Another Dialog, or yad for short, is a very cool program that allows you to add GUI-type interfaces to your shell scripts. There’s a lot you can do with it, and I’d like to show you a few simple examples.
The yad Basics
In the yad
man page, you’ll see a list of pre-defined components that you can use in your yad
scripts. For example, if you do yad --file
, you’ll open the file manager that looks like this:
Figure 16.1: The yad file manager
As it is, this file manager won’t do anything for you. If you click on a file and then click the OK button, the manager will close and the name of the file that you chose will print out on the command line, like this:
donnie@fedora:~$ yad --file
/home/donnie/win_bentley.pdf
donnie@fedora:~$
To make this useful, you’ll need to add code that will perform some desired action upon the chosen file. Before we attempt something this complex...