How to write notification displaying application?

Krzysztof Konopko krzysztof.konopko at gmail.com
Fri Apr 12 04:20:52 PDT 2013


2013/4/12 Piotr Husiatyński <piotrhusiatynski at gmail.com>

> Now it does work, but only if there's another application that is handling
> notifications.
>

How is it possible that there's no service that owns
'org.freedesktop.Notifications'
name?  Can you give more context?  Specific OS?  Embedded system?
In my situation (desktop Gnome-based Linux) it's always either gnome-shell
or notification-daemon.


> I checked documentation for this:
> http://dbus.freedesktop.org/doc/dbus-daemon.1.html
>
> "Eavesdropping" occurs when an application receives a message that was
> explicitly addressed to a name the application does not own, or is a reply
> to such a message."
>
> This make sense, because it appears that my code is listening to messages
> and gives me those that are matching the filter, but none of those messages
> are for my app directry. That's why there's nothing comming if there's no
> other application listening to notifications.
> Where can I learn how to register my application so that all notifications
> will be send directly to it?
>
>

So do you want only to monitor notifications or take them over?



> 2013/4/12 Krzysztof Konopko <krzysztof.konopko at gmail.com>
>
>> Hi,
>>
>> In your MATCH string you're missing eavesdrop='true':
>> MATCH = "type='method_call',interface='org.freedesktop.
>> Notifications',member='Notify',eavesdrop='true'"
>>
>> I tried it on my laptop and now it's OK.
>>
>> This is required since 1.6.x series I think so might not be googlable yet.
>>
>> Cheers,
>> Kris
>>
>> 2013/4/12 Piotr Husiatyński <piotrhusiatynski at gmail.com>
>>
>>> Hi,
>>> I'm trying to write an application that will display all notifications. I
>>> want to register new service for the org.freedesktop.Notifications.
>>> I searched for working examples, but I got stuck with nothing. So far,
>>> I'm
>>> trying to have a working example using python 2.7. I'm sending messages
>>> using notify-send and except of my broken script, all notification
>>> daemons
>>> are working (receiving messages).
>>> I will appreciate any help on that.
>>>
>>> Here's what I'm doing:
>>>
>>>
>>> import gtk
>>> import dbus
>>> from dbus.mainloop.glib import DBusGMainLoop
>>>
>>> MATCH =
>>> "type='method_call',interface='org.freedesktop.Notifications',member='Notify'"
>>>
>>> def message_filter(connection, message):
>>>     print(message)
>>>
>>> def main():
>>>     DBusGMainLoop(set_as_default=True)
>>>     bus = dbus.SessionBus()
>>>     bus.add_match_string(MATCH)
>>>     bus.add_message_filter(message_filter)
>>>     gtk.main()
>>>
>>> if __name__ == "__main__":
>>>     main()
>>>
>>> _______________________________________________
>>> dbus mailing list
>>> dbus at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/dbus
>>>
>>>
>>
>> _______________________________________________
>> dbus mailing list
>> dbus at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dbus
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20130412/97f82da9/attachment-0001.html>


More information about the dbus mailing list