go-notify-darwin

Rich notifications on macOS for Go
Log | Files | Refs | README | LICENSE

README.md (1030B)


      1 # go-notify-darwin
      2 
      3 This package binds to Apple's UNNotificationn framework in order to create rich notifications.
      4 A large part of the API is surfaced, however no guarantee is made about feature completeness
      5 or API stability.
      6 
      7 ## Usage
      8 
      9 Register your categories with `notify.Init`.
     10 Set your callback with `notify.SetCallback`. This will be called upon user interaction.
     11 Push notifications with `notify.Notify`.
     12 
     13 ## Conveniences
     14 
     15 In order to make this API convenient it allows you to specify actions within notifications directly.
     16 On the backend an ad-hoc `UNNotificationCategory` is created for that notification.
     17 The traditional method on macOS is to rather register all of your application's notification categories
     18 at init time, which you can do via the `notify.Init` function.
     19 
     20 ## Caveats
     21 
     22 For notification interactions to work you must have an `NSApp` running. 
     23 The example relies on [Gio](https://gioui.org) for this. 
     24 
     25 ## Example
     26 
     27 To run the example:
     28 
     29 `cd ./example && go generate . && ./example.app/Contents/MacOS/noti`
     30 
     31