Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default "Sound" behavior #9

Open
TylerLeonhardt opened this issue Dec 3, 2018 · 6 comments
Open

Default "Sound" behavior #9

TylerLeonhardt opened this issue Dec 3, 2018 · 6 comments
Labels
enhancement New feature or request

Comments

@TylerLeonhardt
Copy link
Collaborator

Some options:

  1. whatever the default sound is for that platform (if the platform supports sound)
  2. no sound at all

Number 1 means we'd support a -Silent switch parameter
Number 2 means we'd support a -Sound $someStr parameter

I think we should do number 1 first and then add number 2 so that users can specify their own sound files

@Windos
Copy link
Owner

Windos commented Dec 3, 2018 via email

@TylerLeonhardt
Copy link
Collaborator Author

It looks like linux supports it as a hint

http://www.galago-project.org/specs/notification/0.9/x344.html

 "sound-file"     | string     |   The path to a sound file to play when the notification pops up.    

looks like there's no default sound though. Maybe for linux, no sound is a good default... and then we can allow users to specify the sound file which should work cross-plat.

There's some work I'll have to do in PSNotifySend to support this.

@markwragg
Copy link
Collaborator

MacNotify works by looking in all the default directories for sounds and then populating the parameter set dynamically with the names of the files. This is what makes the module PowerShell Core specific as I think the functionality to do so via a class is core specific.

While figuring out how to do it I noticed there was an open issue to add the technique to the documentation, which I then did, so the way I'm using it in MacNotify is also the documented example: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions_advanced_parameters?view=powershell-6#dynamic-validateset-values

@steviecoaster
Copy link
Collaborator

So I've done a fair bit of playing with this today. It looks like all the major distros (CentOS,Ubuntu,Debian,Fedora) have a paplay binary which can play any filetype.

Testing againt what's it /usr/share/sounds/gnome/default/alerts on each system yielded 100% success rate in hearing the audio.

Armed with that data, I intend to stream tonight on a new branch which adds the -Sound parameter to Send-OSNotification.

@steviecoaster steviecoaster added the enhancement New feature or request label Feb 8, 2019
@TylerLeonhardt
Copy link
Collaborator Author

I did the work in PSNotifySend to expose a -SoundFile so that should be ready :)

@TylerLeonhardt
Copy link
Collaborator Author

Also, I noticed that notify-send has a --category (which is exposed in PSNotifySend) that gives you a bunch of sounds for different notification types:

"device","device.added","device.error","device.removed",
        "email","email.arrived","email.bounced",
        "im","im.error","im.received",
        "network","network.connected","network.disconnected","network.error",
        "presence","presence.offline","presence.online",
        "transfer","transfer.complete","transfer.error"

and I'm wondering if that's useful here... not quite sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants