Kubuntu Notification Helper

This is one of the first developing fruits that developed under the guidance of the Project Timelord roadmap. But before I talk about Kubuntu Notification Helper, I should give a little history about its predecessor, Update Notifier KDE.

Update Notifier KDE

One and a half years ago when work on Kubuntu 8.10 started, we found ourselves in need of a new update notifier. The new Adept didn’t have one yet, and the old Adept was incompatible with KDE4 due to the lack of a Konsole KPart in our kdebase packages. (Now at KDE4) So Riddell whipped up a simple PyKDE KApplication that would spawn KSystemTrayIcons when updates were available, upgrade information was available, apport crash notifications were available, or reboot notifications were available.

In Kubuntu 9.04 Update Notifier KDE gained the abilities to notify the user of installable nonfree software such as the Flash plugin and MP3 codecs. In Kubuntu 9.10 update notification was taken over by KPackageKit, but since KPackageKit only covered software update notification, Update Notifier KDE was kept around to do everything else it does.

It is right about now that I would like to talk about the Achilles heel of Update Notifier KDE, its RAM usage. This was worse when it actually notified of software updates, easily taking up 32 MB of RAM while checking for updates. But even now in Kubuntu 9.10, by my somewhat-unscientific benchmarks using KSysGuard (why hello there, seli), Update Notifier KDE still uses 10 MB of unshared RAM while doing nothing, waiting for things to happen. I believe, mainly, that this is Python overhead, demonstrating that Python’s niche is definitely not notification daemons. 10 MB is always too much RAM taken to do nothing.

Kubuntu Notification Helper

It was for the following reasons that Harald and I decided to start a C++ KDE Daemon-based rewrite of Update Notifier KDE:

  • C++ would be much better on RAM usage.
  • The old python script was sorta getting a bit messy
  • It didn’t actually do update notification anymore, and we had to change the name anyway.

Before I continue on, I would like to emphasize that this is not a certainty for Kubuntu 10.04. While Kubuntu Notification Helper does do what it does better than Update Notifier KDE, it is also new. If it cannot meet the functionality that Update Notifier KDE currently offers then it will not replace Update Notifier KDE for 10.04.

That being said, it already does quite a bit of what Update Notifier KDE currently does. At the moment it does:

  • Apport crash report notification
  • Upgrade hook notification (e.g. telling you to restart Firefox)
  • Reboot notification

It currently lacks the following features that Update Notifier KDE currently has:

  • Codec installation notification
  • Distribution upgrade notification (e.g. 9.04 -> 9.10 upgrade notification)

As I mentioned before, Kubuntu Notification Helper is a KDED module written in C++. Initially I did a quick port of the reboot and apport notification from Update Notifier KDE, making a simple C++ KApplication-based notifier that notified with your standards Plasma KNotifications. This alone used 5x less RAM than the current python script, so I got excited and moved from a KApplication to a KDED module, which saved even more RAM usage. Now at idle it only uses 0.3 MB of RAM, and only uses 1-2 MB or so when displaying a notification. (Except upgrade hooks… will get to that later) At idle, this is around a 50x improvement from update-notifier-kde, and at least a 5x improvement while actually doing things. :)

Around this time, Harald Sitter (apachelogger) came around with the idea of making a centralized Event class on which to base each of our things we wanted to notify. Instead of being functions in a declarative-script-type class, each Event is only created when needed. I must say that his design is superb, and it made the code base cleaner, more consistent and more efficient. Harald could probably wax on about the implementation details better than I can, so I’ll leave that up to him. ;-)

So, screenshot time. First off I will tackle Apport notification:


Now, I’m not a big fan of apport’s crash handler. Dr. Konqi ftw. But Apport still has its uses, for example reporting bugs for package upgrade failures. Even though there’s a good chance Apport crash detection will be turned of in 10.04, apport will still be around for things like package upgrade failures. Anyway, the UI is fairly straightforward here. Clicking “details” will launch the apport dialog, and ignore will dismiss the notification. “never show again” will free you from apport notifications permanently if you so desire. The current plan for “Ignore forever” is probably to make a config module where you can manage the notifications you want K-N-H to give. Perhaps it will be made a sub-module of the Notifications module in System Settings.

Next comes the reboot notification:

Reboot notification

Not much different than what we currently have. Clicking reboot will bring up the standard KDE  dialog confirming that you really want to reboot. The Ignore buttons function as before. And yes, we will make the ignore texts consistent eventually. ;-)

Last is the upgrade hook notification:


It looks similar to the rest of the notifications. But we have to provide our own UI for presenting the notifications to the user, since there may be multiple notifications:


Here’s the second page, so that you can see it:

hookdlg2Mutliple hooks will show up paged as seen in the screenshots. The sidebar will go away (automagically thanks to KDE) when only one hook is available. This implementation is sub-optimal at best. Eventually it’d be nice to just make a KNotification for each upgrade hook. This is just the quickest way I could port the functionality over from Update Notifier KDE.

In fact, the whole hook parsing setup could use some love, as its somewhat inefficient and complicated. If there was a simple RFC822 parser in C++, I would gladly use it rather than my custom parser, which is quite RAM hungry. I should note that even though hook handling is RAM-hungry, it only uses 6 MB RAM, which still manages to only be 60% of what Update Notifier KDE uses at idle, which I find quite amusing. You don’t see upgrade hooks that often anyways, so it shouldn’t be a problem, especially since it is using the RAM to actually do something. Code first, optimize later, right? At the least it all works. :)


I sincerely hope we can implement codec and distribution upgrade notification in Kubuntu Notification Helper so that it can be included in 10.04. Less bloat is always good. If you know C++ (a bit of python knowledge wouldnt’ hurt) and would like to help us with this piece of software, feel free to jump in! You can find the code here, and all you need to do to get started is to do a bzr branch lp:kubuntu-notification-helper to check out the source.

About these ads

30 Responses to Kubuntu Notification Helper

  1. ScottK says:

    Can we please have update-notification back in this too. The KPackageKit notification is just beyond bad.

  2. thorGT says:

    One question : does this use native KDE notification system or reinvent the wheel again? Or am I misunderstanding something and this is not related to KDE notification system?

  3. thorGT says:

    OK, sorry for the noise, after reading it again carefully everything is clear.
    I was asking just because there was another notification system introduced in Kubuntu, so I was a bit lost.

  4. sim0n says:

    Does this really only work with Kubuntu or any deb-based distro ?
    I’m a Debian user and am really missing such a tool, so it would be nice if it wasn’t Kubuntu specific but rather deb-specific :-)

    • echidnaman says:

      In theory it should work with any Debian-based distro.
      I’ve not tried it on anything other than Kubuntu 9.10/10.04, so testing is very much welcome to that point.

      • sim0n says:

        That’s great !
        Well I’d be happy to help and test it on debian (lenny, currently kde-4.3.2), if you can give me some hints on where to start ? :-)

      • echidnaman says:

        Hmm, I haven’t prepared packages for any distro for it yet. You could install bzr and then do a:
        bzr branch lp:kubuntu-notification-helper

        to get the source.
        Then you’d build it like any other KDE app. After that I’ve given instructions for enabling/using it in the README file.

  5. Naproxeno says:

    Yes! I don’t know how Project Timelord will end up (I hope it will exceed everyone’s expectations, of course) but this start is really promising. This attitude of trying to do things “the right way”, this attention to detail has been very much needed in Kubuntu for some time.

    So, thank you and wish you the best luck!

    (I know some C++ and would really like to help the project but I can’t promise nothing yet…)

  6. SaySomething says:

    One of the points in Project Timelords is that you speak to upstream regarding several different aspects. Was this something you talked about with KDE developers, i.e. do they think that this is the right way to do it?

  7. KDS says:

    This is great! I hope you can finish this for 10.04.

    regarding python.. what about the printer-applet? :)

    • echidnaman says:

      I would like to get around to that eventually. The only problem is that printer-applet is deeply integrated with system-config-printer which is written in python itself. It will be considerably harder to port.

  8. Stephen says:

    Obviously it’s not done…

    It’s ugly.

    • echidnaman says:

      That’s just the Plasma theme I’m using. Since notifications are handled by Plasma it’ll follow your theme settings, whatever they are. (That theme could be better, but I liked the panel since it works well without desktop effects)

  9. Luis says:

    It looks great already. One suggestion: put the time on the notification so users can see how old it is in case they don’t interact with it right away. Keep up with the good work.

  10. petifrancais says:

    Sorry but what is your widget theme ?^^

  11. Matt Parry says:

    Hi Jonathan,

    Can you please do a blog post on how to join / get involved with this timelord project.

    Also it is great to see blogs on what is moving forward with Kubuntu on planetkde. Im sure that Riddle is very busy but it would be nice to see positive blogs rather than just one sentence ‘we need beta testers’ blogs.

    Thanks – keep up the good work. All the best

  12. Socceroos says:

    echidnaman: quite incredibly, you’ve replied to every question asked in this blog post! Bravo, I say.

    But, will you reply to my question?

  13. [...] a general overview on what Kubuntu Notification Helper is, see my previous blog post. There have been new developments since then, though, which I will touch upon in this blog post. [...]

  14. [...] a general overview on what Kubuntu Notification Helper is, see my previous blog post. There have been new developments since then, though, which I will touch upon in this blog post. [...]

  15. [...] a general overview on what Kubuntu Notification Helper is, see my previous blog post. There have been new developments since then, though, which I will touch upon in this blog post. [...]

  16. Bugsbane says:

    I think it looks great, but…

    actually there is no “but”. It looks great! :)

  17. prasanna says:

    How to stop kpackagekit notification.
    It is coming very frequently and annoying too.

  18. [...] good is an updater, if you don’t have a way to be told of updates? Based heavily off of the Kubuntu Notification Helper, the Muon Notifier notifies of both regular updates as well as distribution upgrades to the next [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 25 other followers

%d bloggers like this: