Created
February 26, 2013 05:55
-
-
Save beccadax/5036219 to your computer and use it in GitHub Desktop.
When a user notification fires while your Mac app is already in the foreground, this code plays the sound, but suppresses the rest of the notification. Put it in your user notification center delegate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)note { | |
if(note.soundName) { | |
[[NSSound soundNamed:note.soundName] play]; | |
} | |
return NO; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment