When you write scripts, you can use Zenity to create simple dialogs that interact graphically with the user, as follows:
When the user closes the dialog, Zenity prints the text produced by the dialog to standard error.
When you write Zenity commands, ensure that you place quotation marks around each argument.
For example, use:
zenity --calendar --title="Holiday Planner"zenity --calendar --title=Holiday PlannerIf you do not use quotation marks, you might get unexpected results.
An access key is a key that enables you to perform an action from the keyboard rather than use the mouse to choose a command from a menu or dialog. Each access key is identified by an underlined letter on a menu or dialog option.
Some Zenity dialogs support the use of access keys. To specify the character to use as the access key, place an underscore before that character in the text of the dialog. The following example shows how to specify the letter 'C' as the access key:
"_Choose a name".Zenity returns the following exit codes:
| Exit Code | Description |
|---|---|
| 0 | The user has pressed either OK or Close. |
| 1 | The user has either pressed Cancel, or used the window functions to close the dialog. |
| -1 | An unexpected error has occurred. |
All Zenity dialogs support the following general options:
Specifies the title of a dialog.
Specifies the icon that is displayed in the window frame of the dialog. There are 4 stock icons also available by providing the following keywords - 'info', 'warning', 'question' and 'error'.
Specifies the width of the dialog.
Specifies the height of the dialog.
Zenity provides the following help options:
Displays shortened help text.
Displays full help text for all dialogs.
Displays help text for general dialog options.
Displays help text for calendar dialog options.
Displays help text for text entry dialog options.
Displays help text for error dialog options.
Displays help text for information dialog options.
Displays help text for file selection dialog options.
Displays help text for list dialog options.
Displays help text for notification icon options.
Displays help text for progress dialog options.
Displays help text for question dialog options.
Displays help text for warning dialog options.
Displays help for text information dialog options.
Displays help for miscellaneous options.
Displays help for GTK+ options.