Friday, September 11, 2009

[Level 2] Shell Interactive With Zenity Episode 6 -- notification

What option can we use, if we want to let user get something show? You can use the option "--notification", the synoposis as the following:

     zenity --notification [--window-icon=path] [--timeout=seconds] [--text=text] [--listen]

Just like "--calendar", if you press "ESC" key or click button "Cancel", the return code will be "1". If you select one option and click "OK", zenity will response the option and return the code will be "0". And also the same effect about the options "--title", "--timeout"...etc, for saving your time, please refer to the previous post "[Level 2] Shell Interactive With Zenity Episode 1 -- calendar", too.

When you enter the command ¨zenity --notification¨, you will get a warning sign on the panel. Ex.
# zenity --notification

# zenity --notification --text="Here is the tip"

The notification also support listening, that means the zenity will receive the message from standard input, then display on the notification. If you want to use this function, you can use the option "--listen". This function include "message", "tooltip", "icon" and "visible". The content and the tag are separated by a colon. The sample as the following:

#zenity --notification --listen
tooltip:Here is the tip

message:Here is the message.


icon: (leave the content empty, for reversing to the original icon)



Wish this helps.

Stanley Huang