Created
September 14, 2013 12:35
-
-
Save stesie/6561696 to your computer and use it in GitHub Desktop.
DBus filter to capture notifications on Nokia N900 phone
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
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