Exploring Zenity Command in Linux
What is Zenity?
Zenity is a program that will display GTK+ dialogs, and return (either in the return code, or on standard output) the users input. This allows you to present information and ask for information from the user, from all manner of shell scripts.
For example, zenity — question will return either 0,1, or 5, depending on whether the user pressed OK, Cancel or timeout has been reached. zenity — entry will output what the user typed into the text entry field.
Use of Zenity:
Zenity can be considered as the replacement of echo command in linux which gives output in the form of dialogue. GTK+ treats a dialog as a window split vertically. The top section is a GtkVBox , and is where widgets such as a GtkLabel or a GtkEntry should be packed.
Zenity Basic Dialog Boxes:
This program follows the usual GNU command line syntax, with long options starting with two dashes(‘-’)
Application options:
— calendar : Display calendar dialog
— entry : Display text entry dialog
— error : Display error dialog
— info : Display info option
— file-selection : Display file selection dialog
— list : Display list dialog
— notification : Display notification
— progress : Display progress indication dialog
— question : Display question dialog
— scale : Display scale dialog
— warning : Display warning dialog
— text-info : Display text information dialog
— color-selection : Display color selection dialog
— password : Display password dialog
— forms : Display forms dialog
To explore more options you can use zenity — help command
Following are some examples of zenity command along with its options:
zenity — calendar — title=”Thats my day” — text=”Select the day” — day=24 — month=5 — year=2000
zenity — calendar — date-format=yyyy/mm/dd
zenity — entry — text=”Enter your text:”
zenity — entry — hide-text
zenity — error
zenity — error — text=”Malware” — icon-name=”Alert” — no-wrap — no-markup — ellipsize
zenity — info — text=”This is the info page”
zenity — file-selection
zenity — list — text=”Enter your List:” — column=”Header”
zenity — list — text=”Enter your List:” — column=”Header” — hide-header
zenity — notification — text=”You have got a notification!”
zenity — progress — text=”Loading…” — percentage=50 — pulsate — auto-close — time-remaining
zenity — question — text=”Are you satisfied with Service?”
zenity — warning — text=”Warning! Still want to proceed?”
zenity — scale — value=25 — min-value=0 — max-value=50 — step=1 — print-partial
zenity — text-info — editable — font=”Calibri” — auto-scroll
zenity — color-selection — color=”Blue”
zenity — color-selection — show-palette
zenity — password — username
zenity — forms — add-entry=MyField — add-password=1234 — add-calendar=”cal” — add-list=”New list” — list-values=”new value’ — column-values=”col” — add-combo=”New Combo” — show header — text=”this is my new form”
zenity — about
zenity — version
You can explore more options with man zenity command which will give you the zenity manual