Bug 392725 - Login sound is never played
Summary: Login sound is never played
Status: RESOLVED FIXED
Alias: None
Product: ksmserver
Classification: Plasma
Component: general (show other bugs)
Version: 5.12.4
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Lubos Lunak
URL:
Keywords:
: 380243 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-04-04 14:33 UTC by kde
Modified: 2019-11-14 18:50 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.12.5


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kde 2018-04-04 14:33:13 UTC
The login sound for plasmashell is never played, although playback works in the settings dialog (it's a simple Ogg Vorbis file). Logout sound plays fine.
Comment 1 Nate Graham 2018-04-04 21:50:34 UTC
...There's a login sound?! :D Same here in Kubuntu 17.10 and Neon dev unstable.
Comment 2 David Edmundson 2018-04-04 22:16:08 UTC
@Nate, there's no login sound set by default
Comment 3 Patrick Silva 2018-04-21 15:47:10 UTC
Cannot confirm on neon dev unstable. Login and logout sounds play as expected.
Comment 4 Nate Graham 2018-04-21 19:28:19 UTC
Sounds like maybe this is distro-specific then? Does Neon turn on the sound by default?
Comment 5 Patrick Silva 2018-04-21 19:45:12 UTC
No. I enabled the sounds manually.
Comment 6 Nate Graham 2018-04-21 21:40:45 UTC
Works for me too in Kubuntu 17.04. Report this to openSUSE if you're still having issues.
Comment 7 Wolfgang Bauer 2018-04-27 10:10:19 UTC
I don't think this is distribution specific.

IMHO, this code in ksmserver/startup.cpp seems to generate an invalid QUrl, if the path in the settings doesn't contain a scheme (which it doesn't if you select a local file in the settings module):
        QUrl soundURL = QUrl(soundFilename); // this CTOR accepts both absolute paths (/usr/share/sounds/blabla.ogg and blabla.ogg) w/o screwing the scheme
        if (soundURL.isRelative() && !soundURL.toString().startsWith('/')) { // QUrl considers url.scheme.isEmpty() == url.isRelative()
            soundURL = QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("sounds/") + soundFilename));

(the QUrl constructor expects an absolute or relative *URL*, and doesn't support local paths, it should probably use QUrl::fromUserInput() instead of QUrl()...)

It works if you manually edit the config file (~/.config/plasma_notifyrc) and prepend a "file://" to the file path.
I.e. something like:
[Event/startkde]
Action=Sound
Sound=file:///home/test/Desktop/login.ogg

For some reason it seems to work with Phonon's vlc backend without this, but not with gstreamer.
Comment 8 Nate Graham 2018-04-27 19:55:58 UTC
Sounds like you know what you're doing, Wolfgang! Would you like to submit a patch to http://phabricator.kde.org/?

Here's the documentation: https://community.kde.org/Infrastructure/Phabricator

Let me know if you need a hand at all.
Comment 9 Wolfgang Bauer 2018-04-28 01:02:48 UTC
(In reply to Nate Graham from comment #8)
> Sounds like you know what you're doing, Wolfgang! Would you like to submit a
> patch to http://phabricator.kde.org/?

Sure, I intended to do that anyway.
I hope I can find the time in the next days.

And no, I don't need a hand, thanks.
I already contributed quite a few times... ;-)
Comment 10 Wolfgang Bauer 2018-04-28 20:56:55 UTC
An additional note about the reproducibility:
The login sound is played fine if you leave the sound file at the default (i.e. only enable it).
But it does not work if you select a different (local) file.

That likely explains why the other two people here were not able to reproduce the problem I think... ;-)
Comment 11 kde 2018-04-28 21:17:40 UTC
Yes, I set a different file than the default one, the classic 'KDE_Startup_1.ogg' to be exact.
Comment 12 Wolfgang Bauer 2018-04-29 21:07:08 UTC
Actually this is the very same problem as bug#337276 in knotifications (from where this code originally comes from), and caused by a change in Phonon 4.9.0.

It has been fixed there by this commit:
https://cgit.kde.org/knotifications.git/commit/src/notifybyaudio.cpp?id=9db06adc8114163f401417064b07772139bc36bc

The same change should fix it in ksmserver too.

https://phabricator.kde.org/D12606
Comment 13 Wolfgang Bauer 2018-04-30 11:47:35 UTC
Git commit 608204765110724f420c978499411e46db1d086e by Wolfgang Bauer.
Committed on 30/04/2018 at 11:42.
Pushed by wbauer into branch 'Plasma/5.12'.

[ksmserver] Use QUrl::fromUserInput to construct sound url

Since Phonon 4.9, this code fails to play a login sound if the sound
file is specified as absolute file path (without "file://"). The reason
is that QUrl() treats the parameter as Url (not as file path), and this
only accidentally worked with earlier Phonon versions but not any more.
This patch uses QUrl::fromUserInput() instead to create a QUrl from the
string in the settings file, which fixes the problem.

This is the same change as
https://phabricator.kde.org/R289:9db06adc8114163f401417064b07772139bc36bc
in knotifications.
A more detailed explanation of the problem can be found in
https://bugs.kde.org/show_bug.cgi?id=337276#c12 .
FIXED-IN: 5.12.5
Differential Revision: https://phabricator.kde.org/D12606

M  +15   -7    ksmserver/startup.cpp

https://commits.kde.org/plasma-workspace/608204765110724f420c978499411e46db1d086e
Comment 14 Nate Graham 2019-11-14 18:50:27 UTC
*** Bug 380243 has been marked as a duplicate of this bug. ***