Zenity — Creates Graphical Dialog Boxes in Shell Scripts

What is Zenity?

Varnikaverma
3 min readSep 23, 2021

--

Zenity is an open source and a cross-platform application which displays GTK+ Dialog Boxes in command-line and using shell scripts. It allows to ask and present information to/from shell in Graphical Boxes. The application lets you create Graphical dialog boxes in command-line and makes the interaction between user and shell very easy.

Usefulness

  1. Easy GUI Creation
  2. Less features than other complex Tools
  3. Enables shell scripts to interact with a GUI users
  4. Simple dialog creation is possible for graphical user interaction

Installation of Zenity in Linux

Zentity is by default installed or available in repository of most of the Standard Linux distribution of today. You can check if is installed onto your machine or not by executing following commands. If it’s not installed, you can install it using Yum command.

Zenity Basic Dialog Boxes

Some of the basic Dialogs of Zenity, which can be invoked directly from the command-line.

  1. Calendar dialogue

2. An error Dialog Box

3. A General text Entry Dialog Box

4. An Information Dialog

5. A question Dialog box

6. A progress Bar

7. A Password Dialog

8. An about Dialog

9. Customizing Dialog

In the below line ‘first’ is a variable and the value of variable is Generated at run time.

  1. –entry‘ means zenity is asked to generate an text Entry box.
  2. – title=‘ defines the title of generated text box.
  3. — text=‘ defines the text that is available on text Entry box.

This line of the below script file is for generation of Information (–info) Dialog box, with title “Welcome” and Text “Mr./Ms. <first>”

To know more about zenity, refer the manual.

--

--