DDMountainNotifier icon indicating copy to clipboard operation
DDMountainNotifier copied to clipboard

Add Alert vs Notification flag

Open edalquist opened this issue 11 years ago • 2 comments

Is it possible to add a flag to generate a persistent "alert" versus a transient notification? I believe the 10.8 API allows for alerts with a close/dismiss button that stay on the screen until user action.

edalquist avatar Dec 27 '12 23:12 edalquist

You need to set the NSUserNotificationAlertStyle to alert in the app's Info.plist

<key>NSUserNotificationAlertStyle</key>
<string>alert</string>

Then

NSUserNotification *note = [NSUserNotification new];
note.hasActionButton = NO; // means the alert will just have a close button, not a show button

However, the user may override the alert setting to banners or none in System Prefs->Notifications:

screen shot 2013-07-25 at 2 33 32 pm

jamesstout avatar Jul 25 '13 06:07 jamesstout

From the OS X release notes:

The user has ultimate control over what notifications are displayed, and the style (banner, alert, etc). There is no mechanism to override the user preferences.

jamesstout avatar Jul 25 '13 06:07 jamesstout