Zenity - Gtk+ dialogs for shell scripts

Just found out about this: "Zenity is a tool that allows you to display Gtk+ dialog boxes from the command line and through shell scripts. It is similar to gdialog, but is intended to be saner. It comes from the same family as dialog, Xdialog, and cdialog, but it surpasses those projects by having a cooler name." Seems to be pretty useful. The original project homepage is at GNOME Live.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Zenity notifications

A Zenity notification can be started to listen for a set of commands on it's standard input.
One line is one command. The following commands are accepted:
  • icon: <filename>
  • message: <UTF-8 encoded text>
  • tooltip: <UTF-8 encoded text>
  • visible: <true|false>
A command line must have the same format as in the above list. Ie. the line must start with a command name, followed by a colon and then the value.
Eg.
cat <<EOH | zenity --notification --listen
message: this is the message text
tooltip: this is the tooltip
EOH

The above example will work, but the notification popup will not be positioned near the notification area, but somewhere else on the screen. To have the notification bubble appear aligned to the notification area, there must be a small delay between the start of zenity and the actual libnotify call (the message).
This workaround fixes the issue (however you'll need bash or something with a compatible process substitution):
exec 3> >(zenity --notification --listen)
sleep 1
cat <<EOH >&3
message: this is the message text
tooltip: this is the tooltip
EOH
exec 3>&-