Custom icon for each NSUserNotification?

Is there a way to provide custom badges for each NSUserNotification instead of the default app logo? Like the iconData parameter in Growl .

I want to show "Someone just posted something" with a photo of that "someone."

+6
source share
4 answers

Currently not (Mountain Lion). You must send a feature request .

+1
source

You still cannot change the default image displaying your application icon, but starting with OS X Mavericks, you can additionally display an additional image using the new contentImage property, for example. eg:

custom image in NSUserNotification

This new property is not documented in the NSUserNotification class NSUserNotification , but is mentioned in Foundation for OS X 10.9 Release Notes .

+8
source

I know this question has been dead for 5 years, but if someone finds this question and is still looking for a solution, there is one:

https://github.com/indragiek/NSUserNotificationPrivate

I tested it on macOS Sierra and it still works. Just be careful when quoting the project creator:

This should be taken for granted, but using any of this will cause your application to deviate from the MAS (Mac Apple Store) and potentially break if the API .

+1
source

Looking for an appropriate answer about NSUserNotifications, I found your question. Officially, this is not yet supported. But I wrote a small user control that you can use that can suit your needs. Check out this Github repository .

0
source

Source: https://habr.com/ru/post/926794/


All Articles