Search code examples
c++libnotifynotify-send

what are the differences in libnotify dev versus libnotify bin


what is the difference in 2 libraries? Which one is prefered for production apps? Why is there significantly different set of dependencies while installing?


Solution

  • There is only one libnotify library. I assume you're asking about the deb packages libnotify-bin and libnotify-dev.

    If so, the difference is very simple: the library packages with -dev suffix contain development files for the library, while packages with -bin suffix may contain some compiled binaries and utilities. To learn more about the contents of these packages, see the list of installed files for dev and bin packages.

    As you are using c++ tag, I assume you need this library to send notifications from your application. In this case you should use libnotify-dev package which provides C API for the libnotify. libnotify-bin contains the notify-send binary which is more suitable for use in shell scripts.

    Here is the minimal example using the library:

    #include <libnotify/notify.h>
    
    int main() 
    {
        notify_init("Test");
        NotifyNotification* n = notify_notification_new ("title", "text", 0);
        notify_notification_set_timeout(n, 3000);
        if (!notify_notification_show(n, 0)) {
            return -1;
        }
        return 0;
    }
    

    Install the libnotify-dev package and compile the example with the following command:

    g++ test.cpp `pkg-config --cflags --libs libnotify`
    

    Then run the result file to see the notification.