Gnome Alert Sound Accepted Solution Not Working

hi, i’ve been having trouble with one very specific thing in gnome on my Pocket Reform lately that i’ve been working at for a few months now in the background:

changing the alert sound to something custom

it seems simple, but the accepted solution is add your sound as a .ogg file in the folder with the others, /usr/share/sounds/gnome/alerts, and then edit /usr/share/gnome-control-center/sounds/gnome-sounds-default.xml, and the sound should magically appear there.

this is not working and i can not find anywhere on the internet where there’s a different solution. using quotes in google doesn’t help, and wording things differently or with just gnome brings me to ubuntu which has this built into the settings app as far as i can tell. my usual tech research tricks aren’t working and it’s been very frustrating because there’s only one accepted solution, and yet that solution does not work.

if someone can help me fix this one thing that would be immensely appreciated, and probably useful to have the solution here in the forums for any other gnome users since the switch to gnome + gdm was made.

1 Like

Which accepted solution are you referring to?

Normally, gnome settings are stored via gsettings… except if it’s a custom keybinding in which case you have to manually add entries to the dconf database because gsettings schema overrides do not support relocatable schemas. Figuring out that custom keybindings are somehow “special” from other settings in gnome took me way too much time.

Now I am baffled by another gnome oddity. Apparently, changing the alert sounds involves changing the following gsetting value:

gsettings set org.gnome.desktop.sound theme-name 'your_custom_theme'

And then you create a directory ~/.local/share/sounds/your_custom_theme and in it you place a file called index.theme with the following content:

[Sound Theme]
Name=YourCustomTheme
Inherits=freedesktop
Directories=.

Once you did that, you can place custom audio files named like what you can find in /usr/share/sounds/freedesktop/stereo into ~/.local/share/sounds/your_custom_theme and files you put in the latter directory will override files you find in the former. For example the “alert” sounds seem to be named bell-terminal.ogg and bell-window-system.ogg.

Whyever this is solved that way and not by modifying a bunch of gsetting key/value entries is completely beyond me… People (probably rightly) complain that customizing sway via a config file is difficult but the gymnastics you have to do to configure gnome also are not fun… :confused:

I hope this helps!

the one about changing the xml file thing, and the themes thing is a gnome tweaks thing and i saw “terminal bell” so assumed people meant something different because there’s gnome terminal and gnome desktop environment. that said i’ll try that later, when i’m not about to sleep

and yeah this bit is baffling, i don’t know why there’s not a button that says “import custom alert sound” and as long as your file is a properly made .ogg file it just, adds it to that list? or something similar.

it does indeed, thank you, i’ll let you know when i try it and if it works and the exact steps i took, because finding an actual step by step guide is difficult, so it’ll be good to have here in the forumns

Could you share a link please? I’m unable to find it.

it’s all over where i search. this arch linux forum thread mentions this solution, and it’s also referenced in this reddit post. those were some of the first results i got off google, and i never found anything different so i didn’t bother going further down or to page 2, which is where the solution you sent was (i re did my search and found your solution later on)

that said, i tried your solution and it didn’t work with the raw files nor symlinks (it uses symlinks when you use the settings app), and discovered that it’s not actually sending any notification sounds at all, period, even when using the default configuration. i didn’t notice because of the constant event sounds from the other bug that makes it think it’s being plugged in and unplugged, that and most of my apps being muted. feel kinda stupid for not noticing that now lol, but hey, no wonder this problem has been driving me crazy, there was an underlying issue all along.

that said, the sound levels for system sounds doesn’t show any activity when i do a test notification (5 second timer) despite clock having sound access, and i don’t know why this is happening. though the lack of activity on the system sound monitor thing in gnome settings leads me to believe the notification (service? daemon?) can’t access the speaker, or doesn’t know where it is, or isn’t working to begin with. i’m not sure how to debug this so any help would be greatly appreciated

All of these tell you to drop files into /usr as the superuser. This is not a good way to solve this:

  1. you want to change a setting for your user account, so you should not require superuser privileges to do so – it should only require changing files in your home directory
  2. changes to /usr will affect all users on your system as you are changing a system-wide setting and system wide admin settings should be performed in /etc and not in /usr – why? because
  3. the directory hierarchy in /usr is managed by your package manager. If you perform changes there, then you make modification behind your package manager’s back. Your package manager may decide to just undo or delete your modifications the next time it upgrades packages and it would not be wrong of it to do so – dropping files into /usr as described in those links is a bad hack

Instead, consider using the mechanism involving ~/.local/share/sounds as I outlined above. If you do not hear the alert sound, then your problem probably lies elsewhere as I just confirmed that my method is working on a vanilla system image using this script:

#!/bin/sh
set -exu
mkdir -p ~/.local/share/sounds/my_custom_theme
cat << 'END' > ~/.local/share/sounds/my_custom_theme/index.theme
[Sound Theme]
Name=MyCustomTheme
Inherits=freedesktop
Directories=.
END
/usr/lib/apt/apt-helper download-file https://upload.wikimedia.org/wikipedia/commons/5/58/Zip_tone.ogg ~/.local/share/sounds/my_custom_theme/bell-terminal.ogg SHA1:b73657b51df8afa7eefe42823d45191562d08f07
ln -s bell-terminal.ogg ~/.local/share/sounds/my_custom_theme/bell-window-system.ogg
gsettings set org.gnome.desktop.sound theme-name 'my_custom_theme'

It creates the directory my_custom_theme and fills it with the index file naming this theme “MyCustomTheme” and then downloads a small 440 Hz tone from wikimedia commons into the right location.

But you generally have sound on your system, right?

yeah it’s not the best, but i hadn’t found better solutions and i’m not sharing the PC so i figured i may as well when i first tried this stuff

i do, it makes sound all the time from the bug that’s being fixed here in the forums that makes sound from thinking it’s constantly being unplugged and plugged back in. i just don’t have alert sounds for notifications for some reason, and i have no idea why