How to implement system notification bell?

Hyprland version
Hyprland 0.51.0 built from branch  at commit 46174f78b374b6cea669c48880877a8bdcf7802f  (version: bump to 0.51.0).
Date: Wed Sep 10 12:41:05 2025
Tag: v0.51.0, commits: 6418
built against:
 aquamarine 0.9.4
 hyprlang 0.6.3
 hyprutils 0.8.4
 hyprcursor 0.1.13
 hyprgraphics 0.1.5


no flags were set

Hi!

I am having trouble implementing a system bell sound for notifications in Hyprland. As I understand it (and I might have understood wrong), it should work something like this:

Execute a script with exec-once with other startup stuff:

#!/bin/sh

handle() {
case $1 in
bell*) mpv /path/to/sound.mp3 ;;
esac
}

socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle “$line”; done

Is this how it is supposed to be done?

I can’t get it to work like this, but I am still learning. I have been trying to find general guides on listening to system events on linux, but haven’t found anything too useful.

Are there any sources I should read about this?

Thank you in advance.

Idea is correct, likely syntax is wrong or path is wrong. You can also use pw-play, it’s better than full blown mpv for such a use case.

Just knowing I’m on the right track is plenty help here, thank you Vaxry!

I joined premium to support your awesome work. Thanks again.