I searched around for a while and came to the conclusion that in this case it is impossible .
You can use Notification.update() to update an existing notification object. But you cannot query existing ones from the system to modify or hide them. It may be possible to save the object somewhere through serialization and restore it for updating. But even then, you still need to know the exact duration of the notification and the timestamp when it starts, since there is no way to check if everything is visible.
A short example of using update() . Just for reference, as the pynotify doc seems almost nonexistent to me:
#!/usr/bin/env python import pynotify pynotify.init("MyApplication") a = pynotify.Notification("Test notification", "Lorem ipsum op") a.show() raw_input("Press return to update the notification") a.update("Updated notification", "Ipsum lorem still op") a.show()
You must call show() after the update. Otherwise, the changes will not be displayed.
The Notification object also has a close () function, but for me it does nothing (there may be a system dependency on Linux / Gnome).
user658042
source share