我已经编写了一个使用Notify的程序,但偶尔我的应用程序中的消息会堆在队列中。然而,我读过关于通知-OSD合并的文章,但是它并不是自动完成的--我如何才能让我的应用程序合并通知,使它们不会一次一次地流进来?
发布于 2013-12-06 13:52:41
您可以通过将提示字符串x-canonical-append设置为true来连接相关通知气泡。
from gi.repository import Notify
Notify.init('test')
n = Notify.Notification.new('Summary', 'Line 1', 'dialog-information')
n.set_hint_string('x-canonical-append', 'true')
n.show()
n = Notify.Notification.new('Summary', 'Line 2', 'dialog-information')
n.set_hint_string('x-canonical-append', 'true')
n.show()有关更多细节,请参见append-hint-python.py python示例( at http://bazaar.launchpad.net/~indicator-applet-developers/notify-osd/trunk/view/head:/examples/append-hint-example.py )。
来源:http://developer.ubuntu.com/resources/technologies/notification/#Concatenating_相关_通知_泡泡
发布于 2011-06-14 18:47:40
如果您在python中开发,请使用通知对象的update方法,那么显示方法:
notification = pynotify.Notification("title", "body", "icon")
notification.show()
#later
notification.update("title2", "body2", "icon2")
notification.show()如果您使用C语言进行开发,则有一个通知_通知_更新()函数做同样的事情。其他语言也有相似之处,但命名方式可能略有不同。
https://askubuntu.com/questions/48773
复制相似问题