Linux — Zenity Command
What is Zenity?
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.
There are other alternatives, but nothing compares to the simplicity of Zenity, specially when you don’t need complex programming. Zenity, a tool you must have your hands on.
Zenity Features
1. FOSS Software
2. Cross Platform Application
3. Allow GTK+ Dialog Box Execution
4. Command Line Tool
5. Support in Shell Scripting
Uses of Zenity
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
Since Zenity is available for all known major platforms, and based on GTK+ library, Zenity program can be ported to/from another platform.
1. Calendar
Syntax : [root@localhost ~]#zenity — calendar
Under option calendar there are many other options. We can put our own text by using option — text=”TEXT” and also set particular day or month or year and display it by default using options
— day=INT_DATE , — month=INT_MONTH , — year=INT_YEAR
2. Entry
Syntax : [root@localhost ~]#zenity — entry
3. Error
Syntax : [root@localhost ~]#zenity — error
We can also give title to this dialogue box and edit the text inside box as we did above.
4. File-selection
Syntax : [root@localhost ~]#zenity — file-selection
When we simply use only file-selection option, we can select one file at a time.
If we ant to select multiple files then we can use option ‘— multiple’ to choose many files at a time.
Also if we want a file to be selected by default then we can give name of file in option — filename=FILENAME
5. Info
Syntax : [root@localhost ~]#zenity — info
This command option simply displays a dialogue box where we can display any text we want.
We can specify the text and title of this dialogue box as we did previously.
6. List
Syntax : [root@localhost ~]#zenity — list column=COLUMN_NAME
We can display a list using list option and also first we have to make a column and give it name. Also we can display text using text option. Also we can pass the elements in list by specifying them into alternate way which is little difficult.
Also we can give check boxes and radio-list the elements in list :
7. Notification
Syntax : [root@localhost ~]#zenity — notification
We have to simply use notification option and add the text to be displayed in notification using text option.
8. Progress
Syntax : [root@localhost ~]#zenity — progress
We can simply display a progress bar and some text above it using text option.
Also we can specify the percentage in progress bar using option
— percentage=INT
Also we can add the pulsation to progress bar using option , — pulsate
9. Question
Syntax : [root@localhost ~]#zenity — question
We can simply ask any question to user and specify question using text option
10. Warning
Syntax : [root@localhost ~]#zenity — warning
We can specify warning to be displayed with text option,
11. Scale
Syntax : [root@localhost ~]#zenity — scale
This option displays a scale bar where we can select a value,
Also,we can specify text using text option and also we can specify default value by option , — value=INT . Also, we can set minimum and maximum values to be selected using options , — minimum=INT , — maximum=INT respectively. Also we can specify the steps by which value can be increased or decreased.
12. Colour Selection
Syntax : [root@localhost ~]#zenity — colour-selection
We can select the colour we want using this option.
13. Password
Syntax : [root@localhost ~]#zenity — password
This option simple collects our password,
14. Forms
Syntax : [root@localhost ~]#zenity — forms
This option opens up a form in which we can specify text,
To know more about zenity , use command man zenity .
Thank You!!!