Skip to content

Conversation

@earboxer
Copy link

Reference: https://specifications.freedesktop.org/notification-spec/latest/ar01s08.html

Added sound-file and sound-name to the data so they'll appear in makoctl list. Also added a criteria for sound-name.

You can use this config to play the sounds:

# Play a sound file when it exists and on-notify isn't overridden
on-notify=exec mpv --really-quiet "$(makoctl list | jq -r '.data[0][0]."sound-file".data')"


# Ring until you click or tap on it
[sound-name="phone-incoming-call"]
on-notify=exec mpv --really-quiet --loop /usr/share/sounds/freedesktop/stereo/phone-incoming-call.oga
on-button-left=exec pkill -9 -f 'mpv .*phone-incoming-call.oga'
on-touch=exec pkill -9 -f 'mpv .*phone-incoming-call.oga'

# Specify any of the sounds you want to hear
[sound-name="message-new-instant"]
on-notify=exec mpv --really-quiet /usr/share/sounds/freedesktop/stereo/message-new-instant.oga
[sound-name="message-new-email"]
on-notify=exec mpv --really-quiet /usr/share/sounds/freedesktop/stereo/message-new-email.oga

Closes #424

Testing notes:

# sound-file hint
notify-send "Where am I?" -h STRING:sound-file:/usr/share/sounds/freedesktop/stereo/audio-channel-front-right.oga
makoctl list | jq -r '.data[0][0]."sound-file".data'
# sound-name hint
notify-send "Click to silence" -h STRING:sound-name:phone-incoming-call
makoctl list | jq -r '.data[0][0]."sound-name".data'

@earboxer
Copy link
Author

Should probably add a "suppress-sound" BOOLEAN criteria... not sure how widely used any of these are.

Dino at least sends sound-name:phone-incoming-call, so, for mako users, this could be an alternative to dino/dino#1203 (assuming you're okay with binding the action to dismiss it).

To improve the user-experience, maybe there should be an 'on-dismiss' binding, because I want to kill the sound AND close the notification.

(And probably the actions should work with this... not sure if that would be possible to script. maybe I'm asking too much of mako at this point.)

@earboxer
Copy link
Author

If we implement "truthy/falsey" string comparisons first as in #471, then it will be easier to specify the config:

[sound-file]
on-notify=exec mpv --really-quiet "$(makoctl list | jq -r '.data[0][0]."sound-file".data')"
[sound-name]
on-notify=exec mpv --really-quiet "/usr/share/sounds/freedesktop/stereo/$(makoctl list | jq -r '.data[0][0]."sound-name".data').oga"

#override specific sound
[sound-name="phone-incoming-call"]
on-notify=exec mpv --really-quiet --loop /usr/share/sounds/freedesktop/stereo/phone-incoming-call.oga
on-button-left=exec pkill -9 -f 'mpv .*phone-incoming-call.oga'
on-button-right=exec pkill -9 -f 'mpv .*phone-incoming-call.oga'
on-button-middle=exec pkill -9 -f 'mpv .*phone-incoming-call.oga'
on-touch=exec pkill -9 -f 'mpv .*phone-incoming-call.oga'

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 this pull request may close these issues.

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

1 participant