Badge and Progress support in Qt Creator

For quite a long time now, Qt Creator has been using the native features of Mac OS X and Windows 7 to display build errors and progress as badges and progress bars on the icon in the Dock and Task Bar respectively. Unfortunately, the X11 variant has been sorely empty. After realizing that a few applications, among them Chrome, could display certain information such as the number of ongoing downloads in Unity, I was wondering how this was implemented.

It turns out that libunity provides all the features required. Applications, identified by their .desktop name, can add progress and a badge. So I implemented it for Qt Creator, here is unity showing two compile errors in a demo application:

qtc_unity_badge

Now the gory details: libunity seems to be binary incompatible. After researching for a while, I noticed that it is best to follow the Chromium implementation and only try to open known-to-work versions of libunity. This it not really optimal, but it works, at least until the next unity release :(.

*Magnum narrator voice on*: Now I know what you’re thinking 1), and you are right: “X11” does not equal “Unity”, but I have no idea if there are equivalents in GNOME 3 or KDE/Plasma. Probably the terminology is just different. If so, I’d happy to learn about them and implement these as well. A plus if there a FD.O library (and I’m afraid there isn’t). If not, I’d like to toss in the question whether KDE should have such a feature, or how else applications can usefully reflect certain statuses while in the background.

1) especially if you are reading this through Planet KDE!

12 Comments on “Badge and Progress support in Qt Creator

  1. icontasks plasmoid in kdeplasma-addons support unity progress. (BTW, without libunity dependency)

  2. KDE does have this feature, KMail shows number of unread messages in the status bar.

  3. This makes no sense, these kind of events need some sort of library support. Icontasks seems to implement special actions in desktop files. White unity also supports that, this is not the feature we need here…

  4. The icon tasks applet supports desktop file actions (quicklist), progress bar and counters.

    The progress bar and counter are send over dbus so icon tasks just registers the dbus interface that’s also used by Unity.

    You could of course do the same on the client side and send the dbus calls instead of relying on libunity to do that.
    The Unity developers however seem to consider the DBUS API *not* stable.

    See https://wiki.ubuntu.com/Unity/LauncherAPI#Low_level_DBus_API:_com.canonical.Unity.LauncherEntry

  5. Actually libunity only wrap up dbus interface which is needed to communicate with panel. I’m sure that icontasks supports unity’s progress and unread item, I once sucessfully make my firefox support progress on icontasks with unity plugin on Chakra.

    The implementation is just like implement unity protocol with qdbus.

    You can check the code.

    https://projects.kde.org/projects/kde/kdeplasma-addons/repository/revisions/master/changes/applets/icontasks/unity.cpp

  6. Yea, I’m pretty sure there’s a nice dbus interface, and one of the taskbal widges in KDE supports the unity features to a ‘tee’. It looks EXACTLY like unity if you use a vertical panel.

  7. Shouldn’t this be part of the notification framework?

    On the iPad I see that these numbers on the icons can have some value, but it’s not useful for important notifications as they are only visible when you are not in any applications and you are on the icon page containing that icon.
    Besides, having different applications using different notification solutions is not good.

    If it was possible to tie this in with the notification framework then the user could decide whether this was wanted, and there could be different default settings for the different Plasma workspaces.