Binding libnotify
One of the benefits of writing C bindings in Crystal is that you only need to bind what you need. In other words, we do not need to fully bind libnotify if we are only going to use a small portion of it. In reality, we really only need four functions:
notify_init
– Used to initialize libnotifynotify_uninit
– Used to uninitialize libnotifynotify_notification_new
– Used to create a new notificationnotify_notification_show
– Used to show a notification object
In addition to these methods, we also need to define a single struct, NotifyNotification
, which represents a notification that can be shown. I determined this by looking at libnotify's *.h
files on GitHub: https://github.com/GNOME/libnotify/blob/master/libnotify. Libnotify's HTML documentation is also included within this chapter's folder on GitHub, which can be used as an additional reference point.
Based on the information from their...