-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KDE notification sounds #124
Comments
Hiho, thanks for looking into this, I have to be honest I kinda never "saw" sound working on KDE either. I always assumed it's just not implemented (being a fairly annoying feature if you think about it). |
As a follow up, I have looked at the KDE source code for KNotifications API and also KNotify. It seems like KNotification is the API responsible for hooking into DBus and rendering notifications with Plasma. From what I can tell, in order to play sounds with Plasma notifications you are required to create a notifyrc file in /etc/knotifications5 along with some configuration for your application and the specific types of "notification events" it can produce. This seems straightforward, and you can also then further configure these events in the Plasma System Settings applet. Anyway, I have tried this and the only result I have obtained is changing the icon of the notifications based on the definition of said notifyrc resource. Which is promising... but I still don't get any sounds no matter what. A key problem seems to be there is no way for me to pass an "event id" (not a notification id, but a KNotification adjacent concept called an event ID). There are some custom hints that I extracted from the KDE source that appear to fit the purpose, but do not seem to work: https://api.kde.org/frameworks/knotifications/html/index.html // define appname (mainframe) and event id (deviceLocated)
Hint::CustomHint("x-kde-appname".into(), "mainframe".into()),
Hint::CustomHint("x-kde-eventId".into(), "deviceLocated".into()), Which would correspond to a resource in /etc/knotifications5 as mentioned: ; /etc/knotifications5/mainframe.notifyrc
[Global]
IconName=mainframe
Comment="Mainframe"
[Event/deviceLocated]
Comment="Device located"
Sound="/etc/mainframe/ping.ogg"
Action=Sound Something like that. That's not exactly what I've used / attempted but it gets the idea across I think. The KDE notification engine appears to be extracting some configuration from that resource file given the appname and event Id I've specified, but it certainly doesn't play a sound. It also doesn't do anything else that can be confgured in that event section, such as say perform text-to-speech or respect the urgency. It's not clear if this is an environment / configuration problem or a missing feature in the KNotification backend. As I've mentioned, there's custom hints, but I can't seem to get it matching up my notification with the event resource. Additionally, there is a DBus endpoint for KNotify that does accept the eventId as a parameter to the method call, but that is obviously not XDG compliant. Do you think this library has room for a KDE-specific backend (perhaps KNotify?), or are you only targeting XDG spec? The inclusion of the WinRT backend appears to answer that question, but I want to be sure before I consider contributing or taking up valuable project time. Thanks! |
Wow! Thank you very much for the extensive documentation. I'd love to support KDE better, as I'm a KDE user myself. |
Are there any news related to this? |
As of knotifications v6.4.0, it appears that notification-specific sounds are not supported. Here is the result of
|
I'm trying to display a notification in KDE Plasma 5.22.5 (X11) and cannot seem to trigger notification sounds because some basic searching revealed that KDE may not implement the XDG sound naming specification / sound theme specification. I looked at the source code, but it looks like the library is just sending the sound name as a message hint over DBus.
Are there any more examples or documentation available for triggering sounds in KDE? Specifically, is it possible to trigger a sound as defined in System Settings > Notifications > Plasma Workspace > Configure Events? It appears that specifying an absolute path (SoundFile hint) does not work, so I can't currently do that either. It's unclear to me if this is a KDE issue, configuration issue, etc.
Thanks!
The text was updated successfully, but these errors were encountered: