<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" type="topic" id="usage" lang="en_GB">
<info>
  <link type="guide" xref="index"/>
  <desc>You can use <app>Zenity</app> to create simple dialogs that interact graphically with the user.</desc>
  <license xmlns="http://projectmallard.org/1.0/" href="https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt">

  <p>This work is licensed under a
  <link href="https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt">GNU Free
  Documentation License Version 1.1</link> or any later version.</p>

	<p>
	  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 href="https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt">link</link>.
         </p>
         <p>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 licence.</p>

	<p>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.</p>

	<p>
	  DOCUMENT AND MODIFIED VERSIONS OF THE DOCUMENT ARE PROVIDED
	  UNDER  THE TERMS OF THE GNU FREE DOCUMENTATION LICENSE
	  WITH THE FURTHER UNDERSTANDING THAT:
	</p>
	<list>
		<item>
		  <p>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 LICENCE. NO USE OF ANY DOCUMENT OR MODIFIED VERSION OF THE DOCUMENT IS AUTHORISED HEREUNDER EXCEPT UNDER THIS DISCLAIMER; AND</p>
		</item>
		<item>
		  <p>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.</p>
		</item>
	  </list>
</license>
</info>
<title>Usage</title>
    <p>
	When you write scripts, you can use <app>Zenity</app> to create simple dialogs that interact graphically with the user, as follows:
    </p>
    <list>
      <item>
        <p>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.</p>
      </item>
      <item>
        <p>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.</p>
      </item>
    </list>
    <p>
	When the user closes the dialog, <app>Zenity</app> prints the text produced by the dialog to standard output.
    </p>

    <note>
      <p>
        When you write <app>Zenity</app> commands, ensure that you place quotation marks around each argument. 
      </p>
      <p>For example, use:</p>
      <screen>zenity --calendar --title="Holiday Planner"</screen>
      <p>Do not use:</p>
      <screen>zenity --calendar --title=Holiday Planner</screen>
      <p>If you do not use quotation marks, you might get unexpected results.</p>
    </note>

    <section id="zenity-usage-mnemonics">
      <title>Access Keys</title>
	<p>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.</p>
	<p>
          Some <app>Zenity</app> 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:
	</p>
	<screen><input>"_Choose a name".</input></screen>
    </section>

    <section id="zenity-usage-exitcodes">
      <title>Exit Codes</title>
    <p>
        Zenity returns the following exit codes:
    </p>

    <table frame="all" rules="all">
        <thead>
          <tr>
            <td>
              <p>Exit Code</p></td>
            <td>
              <p>Description</p></td>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>
              <p><var>0</var></p>
            </td>
            <td>
              <p>The user has pressed either <gui style="button">OK</gui> or <gui style="button">Close</gui>.</p>
            </td>
          </tr>
          <tr>
            <td>
              <p><var>1</var></p>
            </td>
            <td>
              <p>The user has either pressed <gui style="button">Cancel</gui>, or used the window functions to close the dialog.</p>
            </td>
          </tr>
          <tr>
            <td>
              <p><var>-1</var></p>
            </td>
            <td>
              <p>An unexpected error has occurred.</p>
            </td>
          </tr>
          <tr>
            <td>
              <p><var>5</var></p>
            </td>
            <td>
              <p>The dialogue has been closed because the timeout has been reached.</p>
            </td>
          </tr>
        </tbody>
    </table>

    </section>


  <!-- ==== General Options ====== -->

  <section id="zenity-usage-general-options">
    <title>General Options</title>

    <p>
	All Zenity dialogs support the following general options:
    </p>

    <terms>

      <item>
        <title><cmd>--title</cmd>=<var>title</var></title>
	<p>Specifies the title of a dialogue.</p>
      </item>

      <item>
        <title><cmd>--width</cmd>=<var>width</var></title>
	<p>Specifies the width of the dialogue.</p>
      </item>

      <item>
        <title><cmd>--height</cmd>=<var>height</var></title>
	<p>Specifies the height of the dialogue.</p>
      </item>

      <item>
        <title><cmd>--timeout</cmd>=<var>timeout</var></title>
	<p>Specifies the timeout in seconds after which the dialogue is closed.</p>
      </item>

    </terms>

  </section>

<!-- ==== Miscellaneous Options ====== -->

  <section id="zenity-help-options">
    <title>Help Options</title>

    <p>
	Zenity provides the following help options:
    </p>

    <terms>

      <item>
        <title><cmd>--help</cmd></title>
	<p>Displays shortened help text.</p>
      </item>

      <item>
        <title><cmd>--help-all</cmd></title>
	<p>Displays full help text for all dialogues.</p>
      </item>
 
      <item>
        <title><cmd>--help-general</cmd></title>
	<p>Displays help text for general dialogue options.</p>
      </item>
 
      <item>
        <title><cmd>--help-calendar</cmd></title>
	<p>Displays help text for calendar dialogue options.</p>
      </item>
 
      <item>
        <title><cmd>--help-entry</cmd></title>
	<p>Displays help text for text entry dialogue options.</p>
      </item>
 
      <item>
        <title><cmd>--help-error</cmd></title>
	<p>Displays help text for error dialogue options.</p>
      </item>
 
      <item>
        <title><cmd>--help-info</cmd></title>
	<p>Displays help text for information dialogue options.</p>
      </item>
 
      <item>
        <title><cmd>--help-file-selection</cmd></title>
	<p>Displays help text for file selection dialogue options.</p>
      </item>
 
      <item>
        <title><cmd>--help-list</cmd></title>
	<p>Displays help text for list dialogue options.</p>
      </item>
 
      <item>
        <title><cmd>--help-notification</cmd></title>
	<p>Displays help text for notification icon options.</p>
      </item>
 
      <item>
        <title><cmd>--help-progress</cmd></title>
	<p>Displays help text for progress dialogue options.</p>
      </item>
 
      <item>
        <title><cmd>--help-question</cmd></title>
	<p>Displays help text for question dialogue options.</p>
      </item>
 
      <item>
        <title><cmd>--help-warning</cmd></title>
	<p>Displays help text for warning dialogue options.</p>
      </item>
 
      <item>
	<title><cmd>--help-text-info</cmd></title>
	<p>Displays help for text information dialogue options.</p>
      </item>
 
      <item>
        <title><cmd>--help-misc</cmd></title>
	<p>Displays help for miscellaneous options.</p>
      </item>
 
      <item>
        <title><cmd>--help-gtk</cmd></title>
	<p>Displays help for GTK+ options.</p>
      </item>
 
    </terms>

  </section>

<!-- ==== Miscellaneous Options ====== -->

  <section id="zenity-miscellaneous-options">
    <title>Miscellaneous Options</title>

    <p>
	Zenity also provides the following miscellaneous options:
    </p>

    <terms>

      <item>
        <title><cmd>--about</cmd></title>
	<p>Displays the <gui>About Zenity</gui> dialog, which contains Zenity version information, copyright information, and developer information.</p>
      </item>

      <item>
        <title><cmd>--version</cmd></title>
	<p>Displays the version number of Zenity.</p>
      </item>

    </terms>

  </section>

<!-- ==== GTK+ Options ====== -->

  <section id="zenity-gtk-options">
    <title>GTK+ Options</title>

    <p>
	Zenity supports the standard GTK+ options. For more information about the GTK+ options, execute the <cmd>zenity --help-gtk</cmd> command.
    </p>

  </section>

<!-- ==== Environment variables ==== -->

  <section id="zenity-environment-variables">
    <title>Environment Variables</title>

    <p>
      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 <var>WINDOWID</var> environment variable.
    </p>

  </section>
</page>
