Skip to content

Commit

Permalink
Update README.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shea Craig committed Mar 25, 2015
1 parent 37b8680 commit 62e5fbc
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,41 +28,41 @@ You must call the app from the commandline, from the actual binary inside. Feel

```
Usage: /Users/scraig/Library/Developer/Xcode/DerivedData/yo-fdmllzzfcwyljsbbpwhduzpfxeqe/Build/Products/Debug/yo.app/Contents/MacOS/yo [options]
-m, --banner-mode:
Does not work! Set if you would like to send a non-persistent notification. No buttons will be available if set.
-t, --title:
Title for notification
-d, --ignores-do-not-disturb:
Set to make your notification appear even if computer is in do-not-disturb mode.
-l, --lockscreen-only:
Set to make your notification appear only if computer is locked. If set, no buttons will be available.
-s, --subtitle:
Subtitle for notification
-n, --info:
Informative text.
-b, --action-btn:
Include an action button, with the button label text supplied to this argument.
-o, --other-btn:
Alternate label for cancel button text.
-p, --poofs-on-cancel:
Set to make your notification 'poof' when the cancel button is hit.
-i, --icon:
Complete path to an alternate icon to use for the notification.
-c, --content-image:
Path to an image to use for the notification's 'contentImage' property.
-a, --action-path:
Application to open if user selects the action button. Provide the full path as the argument. This option only does something if -b/--action-btn is also specified. Defaults to opening nothing.
-z, --delivery-sound:
The name of the sound to play when delivering. Usually this is the filename of a system sound minus the extension. See the README for more info.
-h, --help:
Show help.
-m, --banner-mode:
Does not work! Set if you would like to send a non-persistent notification. No buttons will be available if set.
-t, --title:
Title for notification. REQUIRED.
-d, --ignores-do-not-disturb:
Set to make your notification appear even if computer is in do-not-disturb mode.
-l, --lockscreen-only:
Set to make your notification appear only if computer is locked. If set, no buttons will be available.
-s, --subtitle:
Subtitle for notification.
-n, --info:
Informative text.
-b, --action-btn:
Include an action button, with the button label text supplied to this argument.
-o, --other-btn:
Alternate label for cancel button text.
-p, --poofs-on-cancel:
Set to make your notification 'poof' when the cancel button is hit.
-i, --icon:
Complete path to an alternate icon to use for the notification.
-c, --content-image:
Path to an image to use for the notification's 'contentImage' property.
-a, --action-path:
Application to open if user selects the action button. Provide the full path as the argument. This option only does something if -b/--action-btn is also specified. Defaults to opening nothing.
-z, --delivery-sound:
The name of the sound to play when delivering. Usually this is the filename of a system sound minus the extension. See the README for more info.
-h, --help:
Show help.
```

Notes:
- Title is mandatory. All other arguments are optional.
- -m/--banner-mode does not seem to work at this time.
- The action argument needs a path or URL. yo just calls ```open```, so anything that would work there, should work here.
- If a "cancel" button doesn't make sense for your needs, but you don't want two buttons on your notification, just use ```-o/--obtext``` with a label that seems appropriate, like "Accept", or perhaps "Confirm", but no ```-b/--btext```.
- If a "cancel" button doesn't make sense for your needs, but you don't want two buttons on your notification, just use ```-o/--other-btn``` with a label that seems appropriate, like "Accept", or perhaps "Confirm", but no ```-b/--btext```.
- Sounds! If you want to use a different sound, you must provide the name of the sound to the -z argument, not the filename. I.e. "Sosumi". The search path is:
- ~/Library/Sounds
- /Library/Sounds
Expand Down Expand Up @@ -101,15 +101,15 @@ yo uses option 2 if you use the --icon option. However, since this is a private

So if you really just want to use *your* icon, you need to build the project in XCode yourself. And even so, there are some issues about getting it to "know" that you've changed the icon.

Notification Center is picky about the icon it displays for your notification. If a notification has been sent previously, a subsequent icon change will not be detected or updated by Notification Center.
Notification Center is picky about the icon it displays for your notification. If a notification has been sent previously, a subsequent icon change will not be detected or updated by Notification Center, as the original one has been cached.

Therefore, my recommendation is to apply the icon you want before sending any notifications for the first time to avoid any hassles. If you get stuck with the wrong icon, you should be able to change the project Bundle Identifier in the project->General pane; or you can increment the build number in the same place.
Therefore, it is easieste to apply the icon you want before sending any notifications for the first time to avoid any hassles. If you get stuck with the wrong icon, you should be able to change the project Bundle Identifier in the project->General pane; or you can increment the build number in the same place. Arguably, you would want to change the Bundle Identifier to match your organization anyway.

See [here](http://stackoverflow.com/questions/11856766/osx-notification-center-icon) for more info.

#### The other nerdery
Normally, for a notification to be persistent (meaning, it stays onscreen until a button is clicked on the notification), the notification needs to be an "alert" style notification. However, Apple does not allow just anyone to make alerts. To use an alert in your app, the app has to be signed with a developer ID.
Normally, for a notification to be persistent (meaning, it stays onscreen until a button is clicked on the notification), the notification needs to be an "alert" style notification. To do this, yo sets the Info.plist key "NSUserNotificationAlertStyle" with value "alert". However, Apple does not allow just anyone to make "alerts". To use an alert in your app, the app has to be signed with a developer ID.

Or does it... There's another private API key that allows you to show buttons on a "banner", which is the default type, and available for unsigned apps. So that's what yo uses.

If that makes you nervous, add a key "NSUserNotificationAlertStyle" with value "alert" to the project's Info.plist and build the app, signed with your own developer ID.
Of course, your results may vary. If you can't get the "alert" style notification to appear, try signing the project with your Developer ID and rebuilding.

0 comments on commit 62e5fbc

Please sign in to comment.