You can use Zenity to create simple dialogs that interact graphically with the user. Usage

When you write scripts, you can use Zenity to create simple dialogs that interact graphically with the user, as follows:

You can create a dialogue to obtain information from the user. For example, you can prompt the user to select a date from a calendar dialogue, or to select a file from a file selection dialogue.

You can create a dialogue to provide the user with information. For example, you can use a progress dialogue to indicate the current status of an operation, or use a warning message dialogue to alert the user.

When the user closes the dialog, Zenity prints the text produced by the dialog to standard output.

When you write Zenity commands, ensure that you place quotation marks around each argument.

For example, use:

zenity --calendar --title="Holiday Planner"

Do not use:

zenity --calendar --title=Holiday Planner

If you do not use quotation marks, you might get unexpected results.

Access Keys

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 dialogue. Each access key is identified by an underlined letter on a menu or dialogue 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".
Exit Codes

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.

5

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

General Options

All Zenity dialogs support the following general options:

<cmd>--title</cmd>=<var>title</var>

Specifies the title of a dialogue.

<cmd>--window-icon</cmd>=<var>icon_path</var>

Specifies the icon that is displayed in the window frame of the dialogue. There are 4 stock icons also available by providing the following keywords - 'info', 'warning', 'question' and 'error'.

<cmd>--width</cmd>=<var>width</var>

Specifies the width of the dialogue.

<cmd>--height</cmd>=<var>height</var>

Specifies the height of the dialogue.

<cmd>--timeout</cmd>=<var>timeout</var>

Specifies the timeout in seconds after which the dialogue is closed.

Help Options

Zenity provides the following help options:

<cmd>--help</cmd>

Displays shortened help text.

<cmd>--help-all</cmd>

Displays full help text for all dialogues.

<cmd>--help-general</cmd>

Displays help text for general dialogue options.

<cmd>--help-calendar</cmd>

Displays help text for calendar dialogue options.

<cmd>--help-entry</cmd>

Displays help text for text entry dialogue options.

<cmd>--help-error</cmd>

Displays help text for error dialogue options.

<cmd>--help-info</cmd>

Displays help text for information dialogue options.

<cmd>--help-file-selection</cmd>

Displays help text for file selection dialogue options.

<cmd>--help-list</cmd>

Displays help text for list dialogue options.

<cmd>--help-notification</cmd>

Displays help text for notification icon options.

<cmd>--help-progress</cmd>

Displays help text for progress dialogue options.

<cmd>--help-question</cmd>

Displays help text for question dialogue options.

<cmd>--help-warning</cmd>

Displays help text for warning dialogue options.

<cmd>--help-text-info</cmd>

Displays help for text information dialogue options.

<cmd>--help-misc</cmd>

Displays help for miscellaneous options.

<cmd>--help-gtk</cmd>

Displays help for GTK+ options.

Miscellaneous Options

Zenity also provides the following miscellaneous options:

<cmd>--about</cmd>

Displays the About Zenity dialog, which contains Zenity version information, copyright information, and developer information.

<cmd>--version</cmd>

Displays the version number of Zenity.

GTK+ Options

Zenity supports the standard GTK+ options. For more information about the GTK+ options, execute the zenity --help-gtk command.

Environment Variables

Normally, Zenity detects the terminal window from which it was launched and keeps itself above that window. This behavior can be disabled by unsetting the WINDOWID environment variable.