Sending notifications from Python
I’ve been using Python to automate some tasks. A common thing with automation is to somehow notify yourself when it’s completed.
Here’s an elegant way to do that in Python (at least for GNOME users):
#!/usr/bin/python
import dbus
sesbus = dbus.SessionBus()
notify_obj = sesbus.get_object('org.freedesktop.Notifications',
'/org/freedesktop/Notifications')
notify_if = dbus.Interface(notify_obj, 'org.freedesktop.Notifications')
notify_if.Notify('HelloWorld',0,'','Summary','Body',[],{},-1)
For details, see pydoc dbus
and the
Notification
Daemon API.