1

There is both zenity and notify-send. (on Fedora/GNOME at least, both seems to be pre-installed.)

So considering I want to show notifications, what are the differences between these too ones?

Is there anyone that is installed in more distros or so (by default)? Is the process of showing notifications any different? Is anyone maybe more compatible to some desktop environments? Is it even available on some desktop environments?

I also noticed the documentation on notify-send is pretty spare. In my Fedora installation, it does not even have a man page…

1
1

Functionality comparison

zenity --notification is equivalent to notify-send for the most simple cases.

For example, these two commands are equivalent:

$ zenity --notification --text=Title
$ notify-send Title

and so are these:

$ notify-send Title 'Long text message'
$ zenity --notification --text='Title\nLong text message'

As you can see, the syntax for notify-send is shorter and simpler, because it is a specialised tool, while --notification is just one of the many commands available in zenity.

Differences are:

  • notify-send has an expire-time option, which however, according to the current man page, is ignored by both Ubuntu's Osd and the Gnome shell.
  • zenity has a --listen option which can change the appearance of the notification without closing and reopening it: message displayed, visibility and icon can all be changed by sending appropriate strings to zenity's standard input.
  • setting an icon requires just --icon for notify-send while it requires --listen and icon: error command on standard input for zenity.
  • category and urgency are set with dedicated options in zenity, while they require a --hint option.

Note that you need to explicitly kill the zenity process when using --listen, because it keeps listening on standard input even after it is closed (this is a bug, I suppose). This is not a problem for complex procedures where the notification changes dynamically, but it makes things unnecessarily complex for simple cases.

Also note that the --hint option of zenity is briefly mentioned by zenity --help-notification, but it is not mentioned in the man page.

Both category and urgency are documented in the Desktop Notifications Specification.

Alternatives

dialog and the old whiptail are possible alternatives, but I don't see any advantage in using them for notifications unless you cannot install notify-send or zenity or you are already using them for other purposes, since both have much more functionality than just notifications.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.