OpenSource programming

April 10, 2008

Plasmoiding notifications and notificating plasmoids

Filed under: General — Dmitry @ 3:12 pm

Ok, I finally got to blog about the stuff I was doing lately 🙂

As I wasn’t quite satisfied with the current visual representation on KDE notifications (KNotify uses KPassivePopup ATM), I decided to try to improve them. Also, hearing all the buzz about plasma I was interested to see how it works and to play with it. And so I went to #plasma, asking for advice on how would it best to proceed with giving more cutie look to KDE notifications 🙂
Aaron immediately suggested me a nice way to go, explained me some details, pointed to the existance of galago spec – so thanks, Aaron! 🙂

I think I’ll start my short description of what have been done with a screenshot:

Notify plasmoid

What you can see above is the very beginnings of the Notify plasmoid – which is capable of showing notifications. It is by no means finished, but it already supports clicking on that “action links” so you’re able to open a new chat :). Also as you can see on second notification – the applet supports showing “timing out” state of notifications – there’s an animated circle that gets sliced as notification’s timeout expires.

Now about how this is works:
I developed a Plasma DataEngine which implements (to some extent) a Galago project’s Desktop Notifications DBus interface. And also I patched KNotify’s NotifyByPopup plugin to forward notifications to this DBus interface when it exists and to fallback to passive popups if DBus interface doesn’t exist. This was what aseigo suggested and it works fine. So here’s a workflow on how things might work on a someone’s system:

– KDE session is started, bringing up KNotify
– KNotify searches for org.kde.Notifications DBus interface, doesn’t find one, so it uses passive popups
– User adds a Notify plasmoid to desktop: plasmoid instanciates its DataEngine which makes org.kde.Notifications appear on a session bus
– KNotify notices this and starts to forward its popups to org.kde.Notifications and stops showing passive popups
– Notify applet reacts on data changes in DataEngine and provides visualizations for coming notifications
– If user clicks on some action in notification in plasmoid, the DBus signal is emitted – KNotify reacts on it by performing assosiated action
– User removes a Notify plasmoid: DataEngine gets destroyed, org.kde.Notifications gets unregistered from session bus.
– KNotify notices this and starts showing passive popups as usual

Nice, isn’t it?
Even more: after patching KNotify, it will be able to use *any* implementation of Galago spec, not necessarily this plasma one.
And therefore notifications might be shown using a native user environment.

So as basic things of DBus interface are now implemented, next will come improvements on visual side – plasma artists will eventually provide me with an applet mockup, so I can make it more good looking and behaving 🙂
Also in #plasma we discussed some ideas about making it an extender in future (Hi, pinda!)

I’m also thinking about merging my KNotify improvements back in trunk eventually – they’re not very obtrusive as they simply add a couple of new methods to NotifyByPopup plugin.
And KNotify continues to work as it does now, unless DBus interface org.kde.Notifications will be found.
I wonder when it will be best to do this merge – as I consider KNotify part mostly complete (of course I’ll post a patch for review on k-c-d prior to merging)

Last but not least, thanks to Thiago and all who worked on QtDBus – it proved to be simple enough to learn and use even for such a newbie as me, who wasn’t experienced with DBus at all 🙂
Ah, and of course, techbase tutorials are very nice – thanks for them too! 🙂


Create a free website or blog at