Bug 482045 - Custom notification sounds do not work
Summary: Custom notification sounds do not work
Status: CONFIRMED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Notifications (show other bugs)
Version: 6.0.0
Platform: Neon Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2024-02-29 15:18 UTC by Kevin R
Modified: 2025-02-06 15:14 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin R 2024-02-29 15:18:50 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Got to Settings > Notifications > Plasma Workspace
2. Most but not all default sound previews work
3. If changing to a different (custom) sound, none of the sound previews work
4. Regardless if using default sounds or custom sounds, notifications don't produce a sound (e.g. Login, Logout, Device Plugged In, and so on)
5. All other sounds work (e.g. playing music from a media app)
6. The only "event" sound that works is the popping sound when changing the volume level
7. I have tried WAV and OGG files

OBSERVED RESULT
Notifications do not produce a sound, regardless if using the default sound or if changing to a custom sound

EXPECTED RESULT
Notifications such as Login, Logout, Device Plugged In should produce a sound if I have a sound assigned.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon 6
KDE Plasma Version: 6.0.0
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2

ADDITIONAL INFORMATION
Comment 1 guimarcalsilva 2024-02-29 23:30:56 UTC
Can you check if they work if you install the package 'ocean-sound-theme'?

sudo apt install ocean-sound-theme
Comment 2 Nate Graham 2024-03-01 07:00:33 UTC
Yeah. Also which theme's previews are you clicking on?
Comment 3 Kevin R 2024-03-01 14:23:32 UTC
(In reply to guimarcalsilva from comment #1)
> Can you check if they work if you install the package 'ocean-sound-theme'?
> 
> sudo apt install ocean-sound-theme

Installing ocean-sound-theme allowed the notification sounds to work, however, they only work under Colors & Themes > System Sounds. Any sounds specified under Settings > Notifications > Plasma Workspace still do not work. I still can only preview thjose default sounds. It seems like the new "System Sounds" theme is overriding the Notifications / Plasma Workspace sound notifications.
Comment 4 guimarcalsilva 2024-03-02 15:49:57 UTC
(In reply to Kevin R from comment #3)
> (In reply to guimarcalsilva from comment #1)
> > Can you check if they work if you install the package 'ocean-sound-theme'?
> > 
> > sudo apt install ocean-sound-theme
> 
> Installing ocean-sound-theme allowed the notification sounds to work,
> however, they only work under Colors & Themes > System Sounds. Any sounds
> specified under Settings > Notifications > Plasma Workspace still do not
> work. I still can only preview thjose default sounds. It seems like the new
> "System Sounds" theme is overriding the Notifications / Plasma Workspace
> sound notifications.

The lack of the ocean theme on Neon was fixed in 481948

I can indeed reproduce the issue on Settings > Notifications > Plasma Workspace though. Custom sounds do not play at all, neither in the notifications nor in the previews
Comment 5 nathan 2024-03-07 15:22:31 UTC Comment hidden (spam)
Comment 6 Kevin R 2024-03-08 15:42:08 UTC Comment hidden (spam)
Comment 7 Kevin R 2024-03-08 15:51:07 UTC
So, it looks like the way Plasma 6 handles sound notifications now, as opposed to previous versions of Plasma, is the sound notifications (Settings > Notifications > Plasma Workspace) are managed by sound "references" as opposed to a direct sound file. So, for example, the default Ocean Catastrophe sound references "dialog-error-serious". I assume there is a file somewhere that references this to the actual sound file itself. I did a context search for dialog-error-serious (as an example) and I was unable to find anything. So, as I mentioned earlier, it looks like the new System Sounds themes manages / overrides the traditional custom notification sounds.

So, this is definitely something that needs to be fixed if custom sound notifications are still going to be an option going forward.
Comment 8 Kevin R 2024-03-08 16:59:58 UTC
(In reply to Kevin R from comment #7)
> So, it looks like the way Plasma 6 handles sound notifications now, as
> opposed to previous versions of Plasma, is the sound notifications (Settings
> > Notifications > Plasma Workspace) are managed by sound "references" as
> opposed to a direct sound file. So, for example, the default Ocean
> Catastrophe sound references "dialog-error-serious". I assume there is a
> file somewhere that references this to the actual sound file itself. I did a
> context search for dialog-error-serious (as an example) and I was unable to
> find anything. So, as I mentioned earlier, it looks like the new System
> Sounds themes manages / overrides the traditional custom notification sounds.
> 
> So, this is definitely something that needs to be fixed if custom sound
> notifications are still going to be an option going forward.

I forgot to mention, no matter what Sound Theme event you choose (e.g. Ocean, Oxygen, FreeDesktop), Settings > Notifications > Plasma Workspace always references the same name (e.g. dialog-error-serious). So this backs up what I mentioned earlier. A data file somewhere is what changes the sound file reference itself.
Comment 9 Nate Graham 2024-03-08 20:28:27 UTC Comment hidden (spam)
Comment 10 Kevin R 2024-03-08 21:50:11 UTC
I found the following file that points all sound themes to their respective sound files:

/usr/share/knotifications6/plasma_workspace.notifyrc

Long story short, Settings > Notifications > <whatever you choose within the list (e.g. Plasma Workspace)> will always need to point to their default sound event name. For example:

Login will always need to point to 'desktop-login'
Logout will always need to point to 'desktop-logout'

These are all defined within the above file 'plasma_workspace.notifyrc', which then directly correlates with the respective theme file that is currently chosen. For example, /usr/share/sounds/ocean/index.theme.

The only way I was able to have my own "custom" sounds was to pretty much create my own theme. However, what I did to test this out beforehand was to copy a couple of my sound files over to an existing theme sound folder (/usr/share/sounds/ocean/stereo), in this case a login and a logout sound file (they also need to be OGA files). I then did the following to rename the files:

sudo mv desktop-login.oga OLD-desktop-login.oga
sudo mv desktop-logout.oga OLD-desktop-logout.oga

sudo mv my_login_sound_file.oga desktop-login.oga
sudo mv my_logout_sound_file.oga desktop-logout.oga

This essentially replaced the original files with my "custom" files. I tested this out and was able to hear my custom logout sound (login still doesn't work, but I believe that is a whole different issue).

So, very long story short, your custom sounds need to be named the exact names that exist within the theme sound folder.

That being said, I really hope this isn't what the KDE team intended to happen, relying only on the sound theme feature. It was a pretty long process renaming all of the sound files I wanted to use. I hope a feature is added to once again allow us to use Settings > Notifications like we have always used it in the past,
Comment 11 Nicolas Fella 2024-03-08 21:54:01 UTC
/usr/share/knotifications6/plasma_workspace.notifyrc contains the system-wide default values for notification settings. Any changes in the KCM should create a local override of that file.

Using custom files is certainly supposed to work
Comment 12 Unamelable 2024-05-26 10:36:21 UTC
I have same problem. It just doesn't seems to play anything than system one.
Comment 13 Unknown 2024-07-18 22:07:58 UTC
Confirming the same problem in lieu of being able to vote on this bug.
Comment 14 Alex Parker 2025-01-09 09:57:25 UTC
Custom sounds doesn't works when choose from files.

But you can always customize preinstalled sound theme.
Do it as described in freedesktop specs about Sound Themes.

Example:
Your base theme now is Ocean. You want to change some sounds for some applications.
0. Okey, first touch ~/.local/share/sounds/__custom/index.theme (two underscores in directory name is mandatory)

1. Add something like this to this __custom/index.theme
[Sound Theme]
Name=Custom
Inherits=ocean
Directories=.
Example=theme-demo

2. Now you can see new theme in Settings — Look & Feel — System Sounds. It named Custom and says it inherits from Ocean theme. When you try preview, this Custom theme must sounds like Ocean. Good start.

3. Now start to add your sounds in .oga/wav format to directory __custom. Right in directory.
I recommend use naming system from parent theme. Look at it to get filenames for common sounds, i.e. message-new-instant.oga for new message sound, and etc. What name for file you use - that name without extension you must use later in App Notifications settings.

4. But this is not all. You can create your own aliases. For example, store in __custom dir new file this-is-my-rifle.oga (just for example)
Now go to App Notifications settings and enable (for any event you want) "Play sound" checkbox, then copypaste in next text field this-is-my-rifle string.
Then click preview button near text field and you must hear this-is-my-rifle.oga

In such manner you can add any sounds to your custom theme and set them up to any application's events.

And one detail in the end. By specs only oga and wav files are accepted. I try mp3 and ogg, it doesn't works.
Comment 15 Nicolas Fella 2025-01-11 22:36:30 UTC
As far as I can tell setting a custom sound works fine. The only issue is that changes only take affect after the application producing the application is restarted
Comment 16 Bug Janitor Service 2025-01-11 23:41:58 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5057
Comment 17 Nicolas Fella 2025-01-13 14:18:36 UTC
Git commit 5463e672abb2201a47b33f2b2d90d91449b85f0d by Nicolas Fella.
Committed on 13/01/2025 at 13:44.
Pushed by nicolasfella into branch 'master'.

[kcms/notifications] Notify running applications about config changes

KNotifications listens to this signal to invalidate the notifyrc cache

This used to be emitted by KNotifyConfigWidget, but we don't use that any more

M  +9    -0    kcms/notifications/sourcesmodel.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/5463e672abb2201a47b33f2b2d90d91449b85f0d
Comment 18 Nicolas Fella 2025-01-13 14:19:12 UTC
Git commit 3f6d0883cf714100acc583f7a794a29a5ee20ecf by Nicolas Fella.
Committed on 13/01/2025 at 14:19.
Pushed by nicolasfella into branch 'Plasma/6.3'.

[kcms/notifications] Notify running applications about config changes

KNotifications listens to this signal to invalidate the notifyrc cache

This used to be emitted by KNotifyConfigWidget, but we don't use that any more
(cherry picked from commit 5463e672abb2201a47b33f2b2d90d91449b85f0d)

M  +9    -0    kcms/notifications/sourcesmodel.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/3f6d0883cf714100acc583f7a794a29a5ee20ecf
Comment 19 Bug Janitor Service 2025-02-06 15:14:53 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5169