YAD dialog examples

yad

Introduction

YAD - (Yet Another Dialog) is a simple tool for developing Graphical User Interfaces. It will integrate with bash.

Type yad --help-all in a terminal to see all command line help.

Unfortunately this help does not provide enough information on how to use yad to it’s full potential.
This is why i wrote this guide.

Most of the information is gathered from YAD help and YAD man page and some examples i have found on internet.

The guide is splited in several pages so it should be easier to find what you are looking for.

If examples used in this guide is from other sources it will be given at the examples.
All screenshots is made by me on Salix OS 15.0 with Qogir icon theme and Salix Gtk3 theme. The Qogir icon theme has its own yad icon and thats why my screenshots don’t have the default YAD icon.

All examples are tested with YAD 12.3 on Salix OS 15.0, However, I have not tested all available options.

I hope you find it usefull.

Cheers
Ingemar

What is YAD

YAD is a program that will display GTK+ dialogs, and return (either in the return code or on standard output) the users input. This allows you to present information, and ask for information from the user, from all manner of shell scripts.

YAD is a fork of the Zenity program, and is written by Victor Ananjevsky <ananasik @ gmail . com>. Yad icon was created by Bogdan Lisovich.

1. About Dialog

yad about
Figure 1. YAD dialog - About

You can create your own about dialog with YAD. Read more about About Dialog here.

2. App Dialog

Display application selection dialog

yad app
Figure 2. YAD dialog - Application

3. Calendar Dialog

Display a calendar dialog.

yad calendar
Figure 3. YAD dialog - Calendar

4. Color Dialog

Display a color selection dialog

yad color
Figure 4. YAD dialog - Color

5. Drag & Drop Dialog

Display a drag-n-drop box.

yad dnd
Figure 5. YAD dialog - Drag & Drop

6. Entry Dialog

Display text entry or combo-box dialog.

yad entry
Figure 6. YAD dialog - Entry

7. File Dialog

Display file selection dialog.

yad file
Figure 7. YAD dialog - File Selection

8. Font Dialog

Display font selection dialog.

yad font
Figure 8. YAD dialog - Font

9. Form Dialog

Display form dialog.

yad form
Figure 9. YAD dialog - Form

With form you can create advanced program.

10. HTML Dialog

Display HTML dialog.

yad html browser
Figure 10. YAD dialog - HTML

11. Icons Dialog

Display icon box dialog.

yad icons item width 100
Figure 11. YAD dialog - Icon

12. List dialog

Display list dialog.

yad list
Figure 12. YAD dialog - List

13. Notebook Dialog

Display notebook dialog.

yad notebook group
Figure 13. YAD dialog - Notebook

With the combination of forms and notebook it is possible to create realy advanced program. Read more about Notebook Dialog here

14. Notification

Display notification.

yad notification
Figure 14. YAD dialog - Notification

15. Paned Dialog

Display paned dialog.

yad paned 1
Figure 15. YAD dialog - Paned

16. Picture Dialog

Display picture dialog.

yad picture fit
Figure 16. YAD dialog - Picture

17. Print Dialog

Display printing dialog.

yad print 1
Figure 17. YAD dialog - Print

18. Progress Dialog

Display progress indication dialog.

yad progress
Figure 18. YAD dialog - Progress

19. Multi Progress dialog

The --multi-progress options seems to be deprecated, instead use --progress see the Multi progress bars section.

yad multi progress bar 1
Figure 19. YAD dialog - Multiple Progress

20. Scale Dialog

Display scale dialog.

yad scale group
Figure 20. YAD dialog - Scale

21. Text Dialog

Display text information dialog.

yad text info
Figure 21. YAD dialog - Text Info

22. Common Options

23. General options

This program follows the usual GNU command line syntax, with long options starting with two dashes ('--').

24. Miscellaneous options

25. Settings

26. Development

27. Environment Variables

YAD_OPTIONS

This variable can holds some default options for yad. All options in this variable may be redefined from command line.

YAD_PID

This variable sets to the value of current dialog’s pid and accessible in all dialog children.

YAD_XID

This variable sets to the value of current dialog’s X Window ID and accessible in all dialog children. This variable is not set in print and notification dialogs, and in a dialogs which acts as a notebook or paned children.

28. User Defined Signals

SIGUSR1

Close dialog with 0 exit code.

SIGUSR2

Close dialog with 1 exit code.

29. Exit Status

Exit codes for user-specified buttons must be specified in command line. Even exit code mean to print result, odd just return exit code.

CODE Description

0

The user has pressed OK button

1

The user has pressed Cancel button

70

The dialog has been closed because the timeout has been reached.

252

The dialog has been closed by pressing Esc or used the window functions to close the dialog

30. Stock Items

This is a list of predefined items available in yad.

ID Label text Icon name

yad-about

About

help-about

yad-add

Add

list-add

yad-apply

Apply

gtk-apply

yad-cancel

Cancel

gtk-cancel

yad-clear

Clear

document-clear

yad-close

Close

window-close

yad-edit

Edit

gtk-edit

yad-execute

Execute

system-run

yad-no

No

gtk-no

yad-ok

OK

gtk-ok

yad-open

Open

document-open

yad-print

Print

document-print

yad-quit

Quit

application-exit

yad-refresh

Refresh

view-refresh

yad-remove

Remove

list-remove

yad-save

Save

document-save

yad-search

Search

system-search

yad-settings

Settings

gtk-preferences

yad-yes

Yes

gtk-yes

31. Examples

Here i have collected some Examples that might be usefull.