notify2 API documentation¶
notify2 is a replacement for pynotify which can be used from different GUI toolkits and from programs without a GUI. The API is largely the same as that of pynotify, but some less important parts are left out.
You can alternatively use the GObject Introspection bindings to libnotify
(from gi.repository import Notify
). I’d recommend that for GTK applications,
while notify2 has fewer dependencies for non-GTK applications. It should be easy
to switch between the two.
Notifications are sent to a notification daemon over D-Bus, according to the Desktop notifications spec, and the server is responsible for displaying them to the user. So your application has limited control over when and how a notification appears. For example, Ubuntu uses the NotifyOSD daemon.
Creating and showing notifications¶
Callbacks¶
To receive callbacks, you must have set a D-Bus event loop when you called
init()
.
-
class
notify2.
Notification