Zenity create a notification icon

by Daniel Pham
Published: Updated:
This entry is part 3 of 13 in the series GUI for bash script using Zenity

To create a notification icon in zenity, use the --notification option. This article will guide you fully on this option of zenity. This option is quite interesting, you can write a bash script using this option to display task reminders for you.

Create a notification icon

To create a notification icon with zenity, just type the following command, replace the text of your text into the command.

zenity --notification --text="Demo text content - WriteBash.com"
Zenity create a notification icon
Demo zenity create notification

As you can see in the image above, a small message window appears at the top of the screen.

All options of notification

To display other options that --notification support, you type the following command:

zenity --help-notification
Zenity create a notification icon
Display other options of notification
OptionsMeaning
--notificationDisplay notification. This is the main option use to create a notification icon.
--text=TEXTSpecifies the text that is displayed in the notification area. Example: –text=”Demo text – WriteBash.com”
--listenListen for commands on stdin. Commands include ‘message’, ‘tooltip’, ‘icon’, and ‘visible’ separated by a colon. For example, ‘message: Hello world’, ‘visible: false’, or ‘icon: /path/to/icon’. The icon command also accepts the four stock icon: ‘error’, ‘info’, ‘question’, and ‘warning’
--hint=TEXTSet the notification hints. Almost not use. Example: –hint=urgency

If you look at the table above, the --notification and --text options are easy to understand and use. I also had the example above.

Of the two remaining options, the --hint option is almost useless. About --listen option, how to use it?

Read moreCreate calendar dialog with Zenity

Okey, I’ll try using it as I wrote in the table above. I’ll using --listen with message command.

zenity --notification --text="Demo text content - WriteBash.com" --listen
Zenity create a notification icon
Use zenity notification with –listen option

In the image above, you can see that if you use the --listen option, it will wait for you to enter the command into the terminal window. In the demo I used the message command, you see that it prints the text content of the message command instead of the text of the --text option.

Conclusion

The --notification option in zenity is very simple, it helps you create a notification icon easily and quickly. What is the idea of using it? You can write a bash script, which is a feature that checks your work hours and tells you when it’s time for dinner.

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating
Series Navigation«« Previous part: Bash create calendar dialog with ZenityNext part: Zenity create color selection dialog »»

You may also like

Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Deon Toulson
Guest
4 years ago

GOOD POST

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.

SUPPORT US

FOLLOW US

Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 DevOpsLite.com – All rights reserved.

Please write sources “DevOpsLite.com” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

2
0
Would love your thoughts, please comment.x
()
x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.