libtinynotify — a smaller implementation of Desktop Notifications

Just a quick note. This week I began a new project, and it’s called libtinynotify. The tagline would probably sound like from the creator of uam, another piece of software to make your systems smaller. But in fact, I don’t think it will. I just used libnotify, and thought it could be done much better.

The highlight in libtinynotify is to keep it simple. When I used the original libnotify in autoupnp, I noticed that it forces my library to link not only with gobject but even with gdk-pixbuf! I reported the bug upstream and they didn’t really care. Why would a simple notifications library force using gdk-pixbuf on all users? That’s not really a good dependency set for a preloaded library which autoupnp is now.

And that’s basically how it all started. First, I wanted to create a smaller, GLib-free variant of libnotify with a compatible API but that’s obviously impossible (due to GObject). And I really didn’t want to push GObject dep into the API. Thus, libtinynotify comes with a new, shiny API.

Although it’s still early work and API can change rapidly, it does its job already. I tried to make it pretty flexible for everyday tasks while keeping it simple. And I think I did pretty well, though I’m open to comments.

If someone wants to give it a try, it’s x11-libs/libtinynotify in mgorny overlay (live ebuild). My playground for it is net-misc/autoupnp (also the live ebuild, in mgorny overlay).

13 thoughts on “libtinynotify — a smaller implementation of Desktop Notifications”

  1. Um, so, what is the point? You are indirectly linking to the gobject/gdk crud anyway. Why bloat the system with *yet another* library? You wanted to streamline the thing, but you are creating the exact *opposite* of that – you are creating additional bloat. Libnotify’s API is not *that* complicated to warrant all of this.

    1. You are indirectly linking to the gobject/gdk crud anyway.

      No, I’m not.

      Why bloat the system with *yet another* library?

      Why bloat the weblog with *yet another* valueless comment?

        1. It is just the input library. It works (supposedly) with the same notification daemons as libnotify does. So, you can say it looks just the same.

  2. Hey, it’s really cool, now I can get rid of last bits of gnome in my system such as gconf and orbit. Thanks a lot!

    1. libnotify actually pulled those in for you? That’s weird.

      Hmm, AFAICS libnotify has a PDEP on virtual/notification-daemon. I guess I would use one too.

      1. Ah, I got it, I had x11-misc/notification-daemon in world, but I do not need it anyway because I use awesome which provides virtual/notification-daemon.

  3. So, how does it work? Should I just install libtinynotify and be ready to go? Should I uninstall libnotify, wait as there is a “tinynotify” USE flag or something else?

    Also, is tinynotify-send neccessary?

    1. So, how does it work? Should I just install libtinynotify and be ready to go? Should I uninstall libnotify, wait as there is a “tinynotify” USE flag or something else?

      You should not care, unless you’re a programmer willing to use it. If you install an app using it, it will be pulled in for you.

      Also, is tinynotify-send neccessary?

      It’s a drop-in replacement for notify-send with a few additional features.

  4. Hey Michael,
    I just came across this in passing. Seems like a good idea: I too was frustrated by the seemingly unnecessary complexity of libnotify. Unfortunately, just FYI, I was unable to get either the master branch or a recent release to build on Ubuntu 10.04.

    If I gen the configuration file locally, I get:
    ./configure: line 10922: syntax error near unexpected token `1.15′

    … and if I use the one from the release, I get:
    lib/notification.c: In function ‘notification_update_va’:
    lib/notification.c:196: error: ‘DBUS_TIMEOUT_INFINITE’ undeclared (first use in this function)

    Sorry I can’t pursue it farther.

    1. For the unexpected token, I can only guess that you don’t have gtk-doc macros.

      About the build error, it seems that you have dbus older than 1.4.12. I failed to notice that DBUS_TIMEOUT_INFINITE is a fairly recent addition, and will fix that in git in a few minutes. Thanks for the report.

  5. I really like the look of libtinynotify, I’m looking for a method of sending system-wide notifications (mainly that I’m going to restart abruptly) to all users that aren’t specifically command line based as most of my users avoid it like the plague.

    My system is Ubuntu-based though http://nebc.nerc.ac.uk/tools/bio-linux/bio-linux-6.0 do you think it would work on Ubuntu? Have you tried and what would be the best approach to install do you think?

    Thanks very much for your help! I can’t believe how tricky it is to find a program or script to do what seems to me to be a really useful thing, I’m glad you’ve put it together for Gentoo at least :)

    Mike

    1. libtinynotify has a sub-library for system-wide notifications. To get it all working, you have to install libtinynotify, then libtinynotify-systemwide and most likely you’ll want tinynotify-send.

      Then, tinynotify-send -w foo bar should do what you want (or the libtinynotify-systemwide if you intent to use it in C code). It’s a little tricky and I haven’t tested it on any other distro but it should work fine. If it doesn’t, feel free to open a bug report and we’ll try to fix it.

Comments are closed.