Created
September 10, 2009 04:36
-
-
Save maxp/184303 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import dbus, gobject | |
import pynotify | |
from lxml import etree | |
from dbus.mainloop.glib import DBusGMainLoop | |
def my_func(account, sender, message, conversation, flags): | |
xml_data = message | |
root = etree.fromstring(xml_data) | |
pynotify.init( "Pidgin Alert" ) | |
n = pynotify.Notification(sender, root[0][0].text, "dialog-info") | |
# number of secs to display message | |
n.set_timeout(10000) | |
n.show() | |
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) | |
bus = dbus.SessionBus() | |
bus.add_signal_receiver(my_func, | |
dbus_interface="im.pidgin.purple.PurpleInterface", | |
signal_name="ReceivedImMsg") | |
loop = gobject.MainLoop() | |
loop.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment