#!/usr/bin/env python from gi.repository import GLib from pydbus import SessionBus from pydbus.generic import signal class Notifications(object): """ """ NotificationClosed = signal() ActionInvoked = signal() def Notify(self, app_name, replaces_id, app_icon, summary, body, actions, hints, timeout): print("Notification: {} {} {} {} {} {} {} {}".format(app_name, replaces_id, app_icon, summary, body, actions, hints, timeout)) return 4 # chosen by fair dice roll. guaranteed to be random. def CloseNotification(self, id): pass def GetCapabilities(self): return [] def GetServerInformation(self): return ("pydbus.examples.notifications_server", "pydbus", "?", "1.1") bus = SessionBus() bus.publish("org.freedesktop.Notifications", Notifications()) loop = GLib.MainLoop() loop.run()