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

This work is licensed under a GNU Free Documentation License Version 1.1 or any later version.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License (GFDL), Version 1.1 or any later version published by the Free Software Foundation with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. You can find a copy of the GFDL at this link.

This manual is part of a collection of GNOME manuals distributed under the GFDL. If you want to distribute this manual separately from the collection, you can do so by adding a copy of the license to the manual, as described in section 6 of the license.

Many of the names used by companies to distinguish their products and services are claimed as trademarks. Where those names appear in any GNOME documentation, and the members of the GNOME Documentation Project are made aware of those trademarks, then the names are in capital letters or initial capital letters.

DOCUMENT AND MODIFIED VERSIONS OF THE DOCUMENT ARE PROVIDED UNDER THE TERMS OF THE GNU FREE DOCUMENTATION LICENSE WITH THE FURTHER UNDERSTANDING THAT:

DOCUMENT IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE DOCUMENT OR MODIFIED VERSION OF THE DOCUMENT IS FREE OF DEFECTS MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY, ACCURACY, AND PERFORMANCE OF THE DOCUMENT OR MODIFIED VERSION OF THE DOCUMENT IS WITH YOU. SHOULD ANY DOCUMENT OR MODIFIED VERSION PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL WRITER, AUTHOR OR ANY CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY DOCUMENT OR MODIFIED VERSION OF THE DOCUMENT IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER; AND

UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE AUTHOR, INITIAL WRITER, ANY CONTRIBUTOR, OR ANY DISTRIBUTOR OF THE DOCUMENT OR MODIFIED VERSION OF THE DOCUMENT, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER DAMAGES OR LOSSES ARISING OUT OF OR RELATING TO USE OF THE DOCUMENT AND MODIFIED VERSIONS OF THE DOCUMENT, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES.

# Uporaba

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

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

You can create a dialog to provide the user with information. For example, you can use a progress dialog to indicate the current status of an operation, or use a warning message dialog 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 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".

# 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 dialog has been closed because the timeout has been reached.

# General Options

All Zenity dialogs support the following general options:

## --title=title

Specifies the title of a dialog.

## --width=width

Specifies the width of the dialog.

## --height=height

Specifies the height of the dialog.

## --timeout=timeout

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

# Help Options

Zenity provides the following help options:

## --help

Displays shortened help text.

## --help-all

Displays full help text for all dialogs.

## --help-general

Displays help text for general dialog options.

## --help-calendar

Displays help text for calendar dialog options.

## --help-entry

Displays help text for text entry dialog options.

## --help-error

Displays help text for error dialog options.

## --help-info

Displays help text for information dialog options.

## --help-file-selection

Displays help text for file selection dialog options.

## --help-list

Displays help text for list dialog options.

## --help-notification

Displays help text for notification icon options.

## --help-progress

Displays help text for progress dialog options.

## --help-question

Displays help text for question dialog options.

## --help-warning

Displays help text for warning dialog options.

## --help-text-info

Displays help for text information dialog options.

## --help-misc

Displays help for miscellaneous options.

## --help-gtk

Displays help for GTK+ options.

# Miscellaneous Options

Zenity also provides the following miscellaneous options:

## --about

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

## --version

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.