Bug 510702

Summary: Sounds don't play in Configure Notifications... dialog
Product: [Frameworks and Libraries] frameworks-knotifyconfig Reporter: skierpage <info>
Component: generalAssignee: David Edmundson <kde>
Status: REOPENED ---    
Severity: normal CC: aacid, guimarcalsilva, kdelibs-bugs-null
Priority: NOR    
Version First Reported In: 6.19.0   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description skierpage 2025-10-17 00:01:07 UTC
SUMMARY
The Ocean theme is part of the KDE org.kde.Platform//6.9 (bug 409300). Yet skrooge nightly makes no sound. I tried another KDE flatpak app, KTeaTime, and make no sounds. But then I tried the kteatime RPM, and that didn't play sounds either :-(

STEPS TO REPRODUCE
1.  Install the KTeaTime flatpak from flathub (or org.kde.skrooge//master from skrooge-nightly), e.g. `flatpak install KTeaTime` in a terminal window.
2.  Run the KTeaTime flatpak from a terminal window, e.g. `flatpak run org.kde.kteatime`.
3.  Find KTeaTime in the system tray (click the ^ arrow), right click on it to bring up its context menu, and choose Configure Notifications...
4. Choose one of the notifications (e.g. "Tea is getting lonely"), and click the [▶] play sound button before the semantic name of the notification (e.g. "dialog-error serious")

OBSERVED RESULT
No sound, and the flatpak displays in the terminal window 
   kf.notifyconfig: Failed to play sound with canberra: File or data not found

But the app has access to /usr/share/sounds/ocean/stereo/dialog-error-serious.oga

EXPECTED RESULT
Sound plays.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 6.4.5
KDE Frameworks Version: 6.19.0
Qt Version: 6.9.3 (Wayland)

ADDITIONAL INFORMATION
I ran strace and some KDE framework tries to access various file paths, e.g. /usr/share/sounds/dialog-error-serious (see strace below) , but there's nothing in any of them. It doesn't attempt to access the actual sounds that the theme places in the directory /usr/share/sounds/ocean/stereo/dialog-error-serious.oga.

Presumably there's some mapping to the Ocean theme (by libcanberra or something else?) that's missing.

I tried installing the Fedora RPM of KTeaTime and that doesn't play sounds either! However, in Notifications > Application Settings > Tea Cooker, there is a similar panel for "Configure Events" and in that clicking the [▶] play sound button does work.

Here's the strace output.  (Weird that KDE tries each one twice).

access("/home/spage/.var/app/org.kde.kteatime/data/sounds/dialog-error-serious", F_OK) = -1 ENOENT (No such file or directory)
access("/home/spage/.var/app/org.kde.kteatime/data/sounds/dialog-error-serious", F_OK) = -1 ENOENT (No such file or directory)
access("/app/share/sounds/dialog-error-serious", F_OK) = -1 ENOENT (No such file or directory)
access("/app/share/sounds/dialog-error-serious", F_OK) = -1 ENOENT (No such file or directory) 
access("/usr/share/sounds/dialog-error-serious", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/sounds/dialog-error-serious", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/runtime/share/sounds/dialog-error-serious", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/runtime/share/sounds/dialog-error-serious", F_OK) = -1 ENOENT (No such file or directory)
access("/run/host/user-share/sounds/dialog-error-serious", F_OK) = -1 ENOENT (No such file or directory)
access("/run/host/user-share/sounds/dialog-error-serious", F_OK) = -1 ENOENT (No such file or directory)
access("/run/host/share/sounds/dialog-error-serious", F_OK) = -1 ENOENT (No such file or directory)
access("/run/host/share/sounds/dialog-error-serious", F_OK) = -1 ENOENT (No such file or directory)
Comment 1 skierpage 2025-10-17 04:41:37 UTC
@guimarcalsilva , any idea what's going on?

The notifications KCM that does play sounds opens up /home/spage/.cache/event-sound-cache.tdb.<long UUID here>.x86_64-redhat-linux-gnu, and then reads
    pread64(27, "ocean\0dialog-error-serious\0en_US"..., 46, 9072) = 46
    pread64(27, "\272\206\361h/usr/share/sounds/ocean/ster"..., 60, 9118) = 60
and then opens a few /sounds locations before opening
   openat(AT_FDCWD, "/usr/share/sounds/ocean/stereo/dialog-error-serious.oga", O_RDONLY) = 28

The Fedora RPM for KTeaTime, and I think its flatpak, doesn't open any kind of cache, it just goes straight to trying to read a generic "dialog-error-serious" (no extension) from various sounds directories.
Comment 2 Albert Astals Cid 2025-10-19 09:59:21 UTC
I don't see how this is a flatpak bug, isn't it a kteatime or knotification bug?
Comment 3 guimarcalsilva 2025-10-19 15:08:26 UTC
This was recently fixed with https://invent.kde.org/packaging/flatpak-kde-runtime/-/merge_requests/307 . Future Flatpak runtime updates should include the fix.
Comment 4 skierpage 2025-10-19 20:33:56 UTC
(In reply to Albert Astals Cid from comment #2)
> I don't see how this is a flatpak bug, isn't it a kteatime or knotification bug?
Sorry, the scope is broader: skrooge and kteatime RPMs and flatpaks don't play notification sounds, but I assume the affected users must be narrow (if all skrooge/KTeaTime/Fedora/?? users had this problem then there should be more complaints).  I'm trying to track it down, meanwhile assuming that others hear notification sounds from KDE apps I changed the project to knotifications and set this to WORKSFORME. 

(In reply to guimarcalsilva from comment #3)
> This was recently fixed with
> https://invent.kde.org/packaging/flatpak-kde-runtime/-/merge_requests/307 .
Indeed, thanks for the fix! My KDE flatpak 6.9 runtime provides the Ocean theme sounds as does Fedora Plasma 6.4.5.
Comment 5 skierpage 2025-10-23 02:58:44 UTC
The good news is the KTeaTime RPM and Skrooge nightly flatpak play their notification sounds in normal operation. But not in their Configure Notifications... dialog (see "STEPS TO REPRODUCE").

If you look at KNotifyConfigActionsWidget::slotPlay() in 
knotifyconfig/src/knotifyconfigactionswidget.cpp , it doesn't seem to be doing any sound theme setting or semantic sound naming, it just assumes the soundFileName is a local file and sets CA_PROP_MEDIA_FILENAME to it.

The applications themselves play the right notifications because NotifyByAudio::playSound() in knotifications/src/notifybyaudio.cpp sets the semantic CA_PROP_EVENT_ID to the soundName and set CA_PROP_CANBERRA_XDG_THEME_NAME (while also supporting setting CA_PROP_MEDIA_FILENAME to a fallbackUrl). System Settings > Notifications > Application Settings does something similar in plasma-workspace/kcms/notifications/kcm.cpp.

It seems to me KDE should have a single lower-level playSound() shared between apps, knotifyconfig dialog, and kcm_notifications that handles both semantic sound names and file paths.