Dunst: Is it possible to play a sound when a notification pops up?

Created on 24 Mar 2016  路  2Comments  路  Source: dunst-project/dunst

Only the first time they are displayed, preferably (not when browsing history).

Most helpful comment

Yes, it is possible by utilizing the scripting feature of the custom overrides.

First, you need some program or script that plays the sound. This script should either ignore all command line arguments or be able to act on those passed by dunst (e.g. play_beep_sound.sh, but not play_sound /path/to/beep.wav). I use a simple shell script named alert.sh (remember to make it executable) for that:

#!/bin/sh
paplay /path/to/alert.wav

Then you need to configure a custom section in your dunstrc. If you want to play a sound on any notification, this should do:

[play_sound]
    summary = "*"
    script = /path/to/alert.sh

After restarting dunst (If it starts automatically, just terminating the running instance should do), it will call the script /path/to/alert.sh every time a notification summary matches the pattern *. As dunst utilized shell-like globbing this means any summary and therefore every notification.


For more information and examples, please have a look at the example dunstrc.

All 2 comments

Yes, it is possible by utilizing the scripting feature of the custom overrides.

First, you need some program or script that plays the sound. This script should either ignore all command line arguments or be able to act on those passed by dunst (e.g. play_beep_sound.sh, but not play_sound /path/to/beep.wav). I use a simple shell script named alert.sh (remember to make it executable) for that:

#!/bin/sh
paplay /path/to/alert.wav

Then you need to configure a custom section in your dunstrc. If you want to play a sound on any notification, this should do:

[play_sound]
    summary = "*"
    script = /path/to/alert.sh

After restarting dunst (If it starts automatically, just terminating the running instance should do), it will call the script /path/to/alert.sh every time a notification summary matches the pattern *. As dunst utilized shell-like globbing this means any summary and therefore every notification.


For more information and examples, please have a look at the example dunstrc.

Awesome! Thank you so much!

I've assigned it to the text sound from Link to the Past, by the way. :)

https://soundgasm.net/u/krompus/LTTP_Text_Donewav

Was this page helpful?
0 / 5 - 0 ratings