sheagcraig / yo

Send Notification Center messages from the command line
Apache License 2.0
384 stars 44 forks source link

-z not working #2

Closed erikng closed 9 years ago

erikng commented 9 years ago

-z /System/Library/Sounds/Glass

Specifying any sounds still only results in a generic noise being generated.

sheagcraig commented 9 years ago

That one is a little tricky. It expects JUST the filename without the extension or path.

So if you want Glass, put -z Glass. As long as the sound is in one of the search paths listed in the README it should work.

erikng commented 9 years ago

Ah! I misread the readme.

erikng commented 9 years ago

Could you add /System/Library/PrivateFrameworks/ToneLibrary.framework/Versions/A/Resources/AlertTones and the sub folders to the default search paths?

sheagcraig commented 9 years ago

At first I thought that wouldn't be possible. The NSUserNotification.soundName option takes a named system sound. See here. So I don't set the search path-that's cooked into AppKit.

But I think I can add another option that will allow you to pass a complete path. If it's present, then I can create a sound object with that filename and assign it a name. Next release!

erikng commented 9 years ago

Sweet! Can't wait. :)

Sent from my iPhone

On Mar 27, 2015, at 7:59 AM, Shea Craig notifications@github.com wrote:

At first I thought that wouldn't be possible. The NSUserNotification.soundName option takes a named system sound. See here. So I don't set the search path-that's cooked into AppKit.

But I think I can add another option that will allow you to pass a complete path. If it's present, then I can create a sound object with that filename and assign it a name. Next release!

— Reply to this email directly or view it on GitHub.

sheagcraig commented 9 years ago

@erikng Hey man-so I tried taking an arbitrary path, creating an NSSound instance, naming it, and then using that named sound, and it didn't work.

But, that being said, the initWithFileNamed method searches through the sound search paths for a file with the right name and will use that successfully. It's now documented in the new version, but for example, you could deploy a sound for yo usage like this:

# Directory probably doesn't exist yet.
mkdir /Library/Sounds
cp ~/Desktop/TheHumptyDance.aiff /Library/Sounds/
# Uses the new built-in (to the package installer) shell script...
yo -t "Limp to the side like your legs are broken..." -z "TheHumptyDance"

Note that the sound HAS to be an aiff, with an extension of .aiff, not .aif. And you don't specify the path at all, or the extension.