statusnotifier: KDE's Status Notifier Item as GObject

Latest version: 1.0.0

The latest version of statusnotifier can be downloaded here. For Arch Linux users, the AUR has a PKGBUILD.

You can find the source code on this GitHub, where you can also report bugs, send suggestions or other (constructive) feedback.

What is statusnotifier ?

Starting with Plasma Next, KDE doesn't support the XEmbed systray anymore in favor of their own Status Notifier Specification.

As it was reported to me that kalu wouldn't work with Plasma Next, since it relies on a systray icon, I started looking into it. Unfortunately, I couldn't find a way to use this interface the way I needed to -- the only library that seemed to support it was Ubuntu's libappindicator (watch out, that page is full of dead links!), but it seemed rather limited.

So, I eventually decided to write my own, and this is the result. This little library allows to easily create a GObject to manage a StatusNotifierItem, handling all the DBus interface and letting you simply deal with the object's properties and signals.

You can simply create a new StatusNotifierItem using one of the helper function, e.g. status_notifier_item_new_from_icon_name(), or simply creating an object as usual - you then just need to make sure to specify property id :

  1. sn = (StatusNotifierItem *) g_object_new (STATUS_NOTIFIER_TYPE_ITEM,
  2.         "id",                       "app-id",
  3.         "status",                   STATUS_NOTIFIER_STATUS_NEEDS_ATTENTION,
  4.         "main-icon-name",           "app-icon",
  5.         "attention-icon-pixbuf",    pixbuf,
  6.         "tooltip-title",            "My tooltip",
  7.         "tooltip-body",             "This is an item about <b>app</b>",
  8.         NULL);

You can also set properties (other than id) after creation. Once ready, call status_notifier_item_register() to register the item on the session bus and to the StatusNotifierWatcher.

If an error occurs, signal registration-failed will be emitted. On success, property state will be STATUS_NOTIFIER_STATE_REGISTERED.

Once registered, you can change properties as needed, and the proper DBus signal will be emitted to let visualizations (hosts) know, and connect to the signals (such as context-menu) which will be emitted when the corresponding DBus method was called.

Simple as that.

Everything should be pretty straightforward, and it comes with HTML documentation to help, as well as a basic example of use. Feel free to ask/comment though, of course.

Read more about statusnotifier

You can check out the following blog posts.

Top of Page