Skip to content

Instantly share code, notes, and snippets.

@stesie
Created September 14, 2013 12:35
Show Gist options
  • Save stesie/6561696 to your computer and use it in GitHub Desktop.
Save stesie/6561696 to your computer and use it in GitHub Desktop.
DBus filter to capture notifications on Nokia N900 phone
import gobject
import dbus
from dbus.mainloop.glib import DBusGMainLoop
def msg_filter(_bus, msg):
if msg.get_member() != "Notify": return
args = msg.get_args_list()
print "%s:%s" % (args[3], args[4])
if __name__ == '__main__':
DBusGMainLoop(set_as_default = True)
bus = dbus.SessionBus()
bus.add_match_string("type='method_call',interface='org.freedesktop.Notifications'")
bus.add_message_filter(msg_filter)
gobject.MainLoop().run()</pre>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment