Cloister bell alert notification from Dunst in Guix
Table of Contents
Intro
In Guix with EXWM I use Dunst for a system alert system. I got my Dunst to have a default audio alert so that when alerts fire, regardless of which of my three monitors I am looking at, I can hear a modest alert noise. I chose the Tardis cloister bell1, a favorite audio of mine.
1. Acquire the sound
I located the sound I want on Soundcloud1 and then used one of the several online SoundCloud downloaders2 to grab the file, which came down as an mp3. I gave the audio a simple name and put it into my ~/Audio
directory.
2. Getting a program to headlessly play mp3s.
All the instructions I found online for hooking audio to Dunst used splay
(which doesn’t seem available in any of my repos) or aplay
, part of AltaAudio which I did have but which was not able to handle mp3s in my given setup. Rather than getting side-tracked by trying to get aplay to deal with mp3 files, I found my repo had mpg321
3 which handled mp3 headlessly just great.
3. creating a shell script to invoke the program on the file
On my load $PATH
I have ~/.local/bin
, so there I put a file I called just bell
(it could have just as well been bell.sh, but the extension would have got in my way)
#!/usr/bin/env bash
mpg321 ~/Audio/cloister.mp3 &> /dev/null
I use &> /dev/null
to make sure it’s silent, without any distracting output (though it might not matter for Dunst, I didn’t bother to find out).
4. Wiring Dunst to trigger the audio for its sound_alert
I just added the following to my ~/.config/dunst/dunstrc
and, upon making sure Dunst had restarted4, I found that I now had by distinct but mild notification sound working for everything Dunst needs!
###
[play_sound]
summary = "*"
script = bell
###
Footnotes
1 Stephanie Gagnon had a great 8-second click here https://soundcloud.com/stephanie-gagnon/tardis-cloister-bell-ringtone It included seconds of blank noise at the end so that alerts don’t gang up on eachother.
2 I used https://www.forhub.io/soundcloud/en/
3 for mpg123 “Fast” and “free software” sound perfect. https://mpg123.de/
4 Dunst will start itself automatically whenever a notification is needed. So killing the current Dunst process with emacs M-x proced
and then testing out the restart with dunstify "Hello World"
and I could hear that we were golden. Without emacs I would have probably have done a pkill dunst
from the command line.