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

Support the "sound-file" and "sound-name" hints #424

Open
Hubro opened this issue Apr 28, 2022 · 5 comments · May be fixed by #470
Open

Support the "sound-file" and "sound-name" hints #424

Hubro opened this issue Apr 28, 2022 · 5 comments · May be fixed by #470

Comments

@Hubro
Copy link

Hubro commented Apr 28, 2022

The FreeDesktop notification spec defines some optional hints that notification servers can support, two of which are "sound-file" and "sound-name", both of which are intended to play a notification sound.

After a bit of testing, it seems like mako doesn't support these hints. I tried notify-send "Sound test!" -h STRING:sound-file:/sound/file/path with an MP3 file and a WAV file, and neither played a sound.

I also tested playing sound names with sounds that are installed on my PC: notify-send "Sound test" -h STRING:sound-name:bell, also without success.

Ideally, all applications that display notifications should use the Desktop Notifications Specification, and ideally they should not play any sound of their own, but instead provide a sound file path or sound name to the notification server. This enables features such as "busy mode" on the notification server to pause notifications, or overriding notification sounds. If the application plays its own audio then a "busy mode" feature would be almost pointless.

But currently, if an application relies on the notification server to play sounds, the notification sound would not play when using Mako. (Unless I misunderstood something.)


Bonus, if Mako added support for "sound-file" and "sound-name", then it would probably be trivial to add a configuration option to set a default value for these hints, in case applications don't provide one. That would solve #36 in a very nice way.

@emersion
Copy link
Owner

Just like #36 explains, mako won't support playing sounds out-of-the-box.

It already supports playing a fixed sound:

on-notify=exec mpv /usr/share/sounds/freedesktop/stereo/message.oga

It could easily support extracting the sound hint via makoctl list.

@Hubro
Copy link
Author

Hubro commented Apr 28, 2022

I didn't know scripts could extract the notification hints, I'll give that a shot.

But it does feel a bit strange that every user has to reinvent the wheel to get their chat application notifications to play sounds that work by default in other desktop environments. Having sounds with your notifications feels like a given in 2022. Would it be at least be reasonable to provide an official example script that makes the "sound-file" and "sound-name" hints work on most systems?

@emersion
Copy link
Owner

If you want a fancy notification daemon, don't use mako. mako is designed to be lightweight and bare-bones.

@Hubro
Copy link
Author

Hubro commented Apr 28, 2022

Of course, I guess we just disagree on the definition of "fancy". Getting an audible notification when receiving an email or instant message has been the norm for as long as I can remember. Sounds is as integral to notifications as audio is video. I wouldn't say a silent movie is bare bones, I would say it's missing something crucial. I definitely wouldn't call a movie with audio "fancy" 🙂

But you are the boss. Unfortunately I'm not actually aware of any other stand-alone notification servers that runs on Wayland, but I will an eye out.

@Hubro
Copy link
Author

Hubro commented Apr 28, 2022

Should all notification hints be included in makoctl list output? I can't seem to get it to work:

➜ notify-send "Sound test" -h STRING:sound-file:/home/tomas/Music/Soundboard/waow.mp3

➜ makoctl list
{
        "type" : "aa{sv}",
        "data" : [
                [
                        {
                                "app-name" : {
                                        "type" : "s",
                                        "data" : "notify-send"
                                },
                                "app-icon" : {
                                        "type" : "s",
                                        "data" : ""
                                },
                                "category" : {
                                        "type" : "s",
                                        "data" : ""
                                },
                                "summary" : {
                                        "type" : "s",
                                        "data" : "Sound test"
                                },
                                "body" : {
                                        "type" : "s",
                                        "data" : ""
                                },
                                "id" : {
                                        "type" : "u",
                                        "data" : 14
                                },
                                "actions" : {
                                        "type" : "a{ss}",
                                        "data" : {}
                                }
                        }
                ]
        ]
}

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

Successfully merging a pull request may close this issue.

2 participants