libosxnotify


No nonsense OS X notifications for scripts.

Some time ago, I decided to refresh and update my C knowledge. Then I thought about a fun way to put this skill into use - write a Python extension that allows displaying OS X notifications without calling a third party app. Then @lukaszkorecki encouraged me to put some more work into it and package the thing as a shared library. This way libosxnotify was born.

In its current form, libosxnotify allows any program to display notifications simply by calling the only exported function - notify. Additionally, I wrote a tiny C program called osxnotify to use in command line, shell scripts etc.

Now, if you have a long-running shell script and want to see a notification when it finishes, you could do the following:

$ ./this_is_gonna_take_some_time.sh && osxnotify "Your script is done"

Python wrappers

Since the project began as a Python extension, I decided to provide Python wrapper alongside the library.

The wrapper comes in two flavors:

  • osxnotify - it uses a native C extension to call libosxnotify,
  • osxnotify-cffi - it uses CFFI to call libosxnotify.

Both wrappers expose the same high level API and are available on PyPI.

Meta

If you like the idea, head on to the project’s repository to learn more about installing the library. As usual, feel free to open issues and submit patches for bugs, features and stuff.

Have fun :).

Tomek Wójcik

Developer, webmaster, part-time bassist, music addict.

BTHLabs owner and mastermind.