The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
2

How can I get audible desktop notifications with i3?

asked 2014-06-16 20:06:09 +0000

robru gravatar image

Hey guys. All I want out of life is desktop notifications that play a sound. Why is this so hard? Here's what i've tried:

  • I'm using i3 on Ubuntu, and I launch gnome-settings-daemon from my i3 config, so by default notify-osd is running. I cannot for the life of me configure notify-osd to play a sound. I've googled and googled and googled, everything says that you just have to select a sound theme in your gnome-control-center, well I've done that and notify-osd does not play a sound.

(I should mention, I know that my soundcard is working, because the sound config panel is able to play test sounds, and I can watch youtube videos, and other things can make sounds. But notify-osd does not make a sound. Ever.)

  • Then I thought i would try out dunst. Dunst of course does not have any sound feature, but it has a feature to run a script. So I wrote a script that plays a sound! Here's the weird thing though: If I run dunst from a terminal, it works great! Plays the sound no problem. But when I start dunst from my i3 config, it totally fails. The first iteration of my script failed because I was using the 'play' command, which by default does not play any sound when run backgrounded. but then I switched it to 'play -q', confirmed that running my script backgrounded still plays a sound, but still running dunst from i3 config does not play a sound. What is going on here?!?!

here is my script:

$ cat .local/bin/dunst_sound.sh
#!/bin/sh -e

play -q /usr/share/sounds/gnome/default/alerts/glass.ogg

Here is the relevant part of my dunstrc:

[sound]
    summary = "*"
    script = ~/.local/bin/dunst_sound.sh

Aaaand here's the relevant part of my i3 config:

exec dunst &
exec gnome-settings-daemon

What have I done wrong here?

Please note, this question isn't "how can I make dunst play a sound". If there's some other notification tool that plays sounds, by all means please recommend it.

But I mean, what the heck is going on here?

  • Running play -q ... in a terminal plays a sound.
  • Running play -q ... & in a terminal plays a sound.
  • Running dunst_sound.sh in a terminal plays a sound.
  • Running dunst_sound.sh & in a terminal plays a sound.
  • Running dunst in a terminal plays sounds when notifications come in.
  • Running dunst & in a terminal plays sounds...
  • BUT running dunst from my i3 config DOES NOT PLAY SOUNDS. Wut?
edit retag flag offensive close merge delete

Comments

You could also use https://github.com/sboli/twmn ....you can specify a sound command for all notifications i.e. sound_command=/usr/bin/aplay /path/to/some/wav

Yenal gravatar imageYenal ( 2014-06-30 13:57:29 +0000 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-06-17 04:03:46 +0000

robru gravatar image

updated 2014-06-17 05:00:19 +0000

Well I wasn't able to figure out dunst. Instead I simply wrote a plugin for my IRC client (Smuxi) to just play the sounds itself. The upside here is that I programmed it to play different sounds based on different highlights, but the downside is that now the script has to load & parse the smuxi config for my highlights every time I receive a message, which can be inefficient.

My karma is insufficient to publish links, but if you were to browse through the robru/dotfiles project on github, and look under .local/share/smuxi/... you would find the script, if you were interested.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-06-16 20:06:09 +0000

Seen: 802 times

Last updated: Jun 17 '14