Monday, 3 October 2011

Open email in browser when Pidgin notifies dbus (tags: Python, dbus, email, notification)

#! /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()

------ Unix is like a wigwam: no gates, no windows and an Apache inside.

Posted via email from kwhitefoot's posterous

No comments:

Post a Comment

Followers