ubuntu的通知机制 参考:
下面是一个简单的python脚本,利用这个新的notify。 效果: https://wiki.ubuntu.com/NotificationDevelopmentGuidelines?action=AttachFile&do=get&target=icon-summary-body.png
#!/usr/bin/python
import sys
import time
import pynotify
if __name__ == '__main__':
if not pynotify.init ("update-notifications"):
sys.exit (1)
# try the icon-summary-body case
n = pynotify.Notification (
"Inital notification",
"This is the original content of this notification-bubble.",
"notification-message-IM")
n.show ()
time.sleep (3); # simulate app activity
# update the current notification with new content
n.update ("Updated notification",
"Here the same bubble with new title- and body-text, even the icon can be changed on the update.",
"notification-message-email")
n.show ();
time.sleep (6); # wait longer now
# create a new bubble using the icon-summary-body layout
n = pynotify.Notification (
"Initial layout",
"This bubble uses the icon-title-body layout.",
"notification-message-IM");
n.show ()
time.sleep (3); # simulate app activity
# now update current bubble again, but change the layout
n.update ("Updated layout",
"After the update we now have a bubble using the title-body layout.")
n.show ()