Skip to content

Instantly share code, notes, and snippets.

@croddy
Last active May 17, 2024 15:49
Show Gist options
  • Save croddy/134780bb8dbe259c12fa to your computer and use it in GitHub Desktop.
Save croddy/134780bb8dbe259c12fa to your computer and use it in GitHub Desktop.
unbreak your X11 bell with pulseaudio
#!/bin/bash
# allegedly these bits can be done in a per-user default.pa, but i could not
# get it to work
pactl upload-sample /home/cmr/sounds/bells/soothingbell.wav soothingbell
pactl load-module module-x11-bell sample=soothingbell
# the default bell volume on my system is very quiet, but you should adjust this
xset b 100
# ...but the default output volume on my system is very loud. allegedly this can
# also be done in default.pa, but i could not get it to work even with pactl.
amixer -D pulse sset Master 50%
@ohnekopf
Copy link

ohnekopf commented Aug 19, 2021

Thanks, i keep coming back to this.
btw, i tried to add this to default.pa and failed shamefully until i read the pulse-cli-syntax (5) manpage. the default.pa syntax isn't consistent with the pactl syntax for some weird reason.
i ended up adding the following to default.pa

load-sample x11-bell /usr/share/sounds/freedesktop/stereo/message.oga


load-module module-x11-bell sample=x11-bell display=:0.0

load-sample here, upload-sample in pactl, god knows why :| Also the argument order is the opposite.
this at first failed and i almost gave up at that point, checking /var/log/syslog I realised that i had left a few whitespace characters after the filename and that was being parsed as part of the filename (as if the file was called 'message.oga '). trimming that fixed it and now i get a nice bell from startup (even before logging in, in the display manager login prompt)
cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment