Monday, 3 October 2011

Immediately show email when Pidgin notifies DBus.

#! /usr/bin/pythonimport webbrowserdef open_email(em_subject, em_from, em_to, em_url):    print(em_subject, em_from, em_to, em_url)    # Open URL in a new tab, if a browser window is already open.    webbrowser.open_new_tab(em_url)if __name__ == "__main__":    import dbus, gobject    from dbus.mainloop.glib import DBusGMainLoop    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)    bus = dbus.SessionBus()        bus.add_signal_receiver(open_email,                            dbus_interface="im.pidgin.purple.PurpleInterface",                            signal_name="DisplayingEmailNotification")        loop = gobject.MainLoop()    loop.run()

Posted via email from kwhitefoot's posterous

No comments:

Post a Comment

Followers