zenity Cheat Sheet
Hello, We are going to expose the zenity command and make a pattern in such a way in your mind that can help you to write zenity commands.
Summary -:
→ Introduction to zenity
→ How to write zenity command
→ Deep dive into zenity
→ Demo
Body
→ Introduction to zenity -:
zenity is software, we know but the main part is it will display dialog box using shell script in command-line.
the dialog box looks like
let’s understand how using shell script in command line
see the below image where we write the command on bash shell it executing some program to pop-up the message.
Before using we know it is software so first, we have to install it.
yum install zenity
→ How to write zenity command:-
To write any command we use the below syntax
syntax:
zenity options
e.g-:
zenity --calendar
→ Deep dive into zenity -:
Let’s see its awesome options to solve real-world use-cases, we know every command gives the document like this zenity also have a doc.
there are two main options zenity have
- Help Options
- Application Options
Help Options -: If you want to learn any command this is the best way to learn the command.
Let’s take first help and see all the options of the zenity command
Application Options -: Total application options here
Help Options and Application Options are not two different topics, let’s directly going to solve real-world problems using zenity then it makes more clarity how its works.
- zenity --calendar: It is used to see the calendar command output in the dialog box.
Now it's time to see the help option of zenity --calendar.
Here two helps for each Application options,
- “--help-general”: in this case, you will get these options for any Application options
2. “--help-calendar”: in this case you will get all the help regarding a particular Application option like in this case helps of calendar.
That’s solved now you are able to make any type of command in zenity worlds, now we are going to directly jumpy to the practicals.
Demos -:)
- --calendar:
zenity --calendar --title=Calendar --width=400
--height=200
2. --entry:
It is used to display the text on the console which is entered into the dialog box.
Real World Use Caes: It is very helpful if we want to take passwords separately we can use this option in apps
3. --error:
You can show an error kind of notification using the “--error” option
4. --info:
Used to see an information dialog
Let’s see the help for --info
5. --file-selection:
It is used to select the file
6. --list:
It is used to create list also have lots of way to make a dynamic list
7. --notification:
8. --progress:
Display progress indication dialog
By default progress command
9. --question:
Display question dialog
Total option for zenity --question
10. --warning:
Display warning dialog.
11. --scale:
Display Scale Dialog
12. --text-info:
Display text information dialog
Special help of --text-info
12. --color-selection:
Display color selection dialog
13. --password:
Display password dialog
14. --forms:
Display forms dialog
This kind of form we can create
Conclusion :-
Zenity is an interesting program we can use in a program to make it more interactable and mature, it also helps to take inputs in different forms like password, form, list, error, notification, and lots more
Thanks
MD MOQADDAS