Bugzilla – Bug 1152751
Amarok - Some global shortcuts don't work
Last modified: 2020-06-23 10:01:24 UTC
Some global shortcuts don't work anymore in Amarok. For example the play/pause (mappend on a media key or on meta+c) and the volume control shortcuts (meta++ and meta+-) don't work. At the same time the mute (media key or meta+m) and the "add media" work fine. When Amarok is in foreground the shortcuts for the same actions (mappend on the default keys, as space for play/pause) work fine. I noticed the same issue on two Tumbleweed installations on two different systems. Amarok 2.9.70 KDE Frameworks 5.62.0
I can't reproduce with my keyboard media keys. Tested with Amarok both in foreground & background Increasing/decreasing volume & play/pause work as intended. However, the global meta + / Meta - shortcuts are used by kwin, did you try setting unused shortcuts in amarok?
Works fine here too. Is kglobalaccel5 running?
Also, is the media player applet active in the system tray? This normally handles those keys by default, and that works fine here. If it's disabled and I explicitly assign the keys to Amarok in systemsettings5->Shortcuts->Global Shortcuts, that indeed doesn't seem to work. IOW, if you assign the keys to "Media Control" in systemsettings5->Shortcuts->Global Shortcuts (and the applet is not disabled in the system tray settings), it should work.
(In reply to Wolfgang Bauer from comment #3) > If it's disabled and I explicitly assign the keys to Amarok in > systemsettings5->Shortcuts->Global Shortcuts, that indeed doesn't seem to > work. And for the record: this problem indeed only seems to exist for *some* global shortcuts. "Play/Pause" e.g. is affected, while e.g. "Next Track" is not.
I'm not sure yet, but it seems that Amarok never actually sets these affected actions as global shortcuts. E.g. Play/Pause has this code in the KDE4 version: PlayPauseAction::PlayPauseAction( KActionCollection *ac, QObject *parent ) : KToggleAction( parent ) { ac->addAction( "play_pause", this ); setText( i18n( "Play/Pause" ) ); setShortcut( Qt::Key_Space ); setGlobalShortcut( KShortcut() ); ... while the KF5 code has this: PlayPauseAction::PlayPauseAction( KActionCollection *ac, QObject *parent ) : KToggleAction( parent ) { ac->addAction( QStringLiteral("play_pause"), this ); setText( i18n( "Play/Pause" ) ); setShortcut( Qt::Key_Space ); ... I.e. the call to setGlobalShortcut() is missing, it seems... In this case, it has been removed in https://git.reviewboard.kde.org/r/129055/, because it was bound to Space which of course is a bad idea for a global shortcut...
Assigning the shortcuts to "Media Control" works fine. Thanks for the workaround. The Amarok code for the shortcuts was last changed in 2017, but I first noted the problem in Tumbleweed last month, so I don't think it's in direct relation. And in the code, for example, the "Mute" Volume" (works) and the "Increase Volume" (doesn't work) look almost the same...
(In reply to Vincenzo Buttazzo from comment #6) > Assigning the shortcuts to "Media Control" works fine. Thanks for the > workaround. Well, I wouldn't really call it a workaround, as it's setup like this by default since a while. The advantage is that you can then control *any* media player (that supports the MPRIS protocol) with these global shortcuts, whereas if you assign keys to Amarok they cannot be assigned to other applications at the same time. See https://cgit.kde.org/amarok.git/commit/?id=53f09800613bc03fe1f82f249eb43ccec028a1cc (which already was in 2.9.0). > The Amarok code for the shortcuts was last changed in 2017, but I first > noted the problem in Tumbleweed last month, so I don't think it's in direct > relation. Those changes were only done in the port to Qt5/KDE Frameworks 5, but Tumbleweed still had the KDE4 version (2.9.0) till about a month ago. > And in the code, for example, the "Mute" Volume" (works) and the "Increase > Volume" (doesn't work) look almost the same... Yeah, the Increase/Decrease Volume shortcuts apparently have a different problem, as Amarok seems to recognize the key press *once* (at least the volume OSD pops up), only further presses have no effect. I'll try to investigate more, but this might be trickier to figure out. But assigning the keys to "Media Control" does work fine in this case as well. This patch at least does fix the Play/Pause global shortcut here: diff --git a/src/ActionClasses.cpp b/src/ActionClasses.cpp index 324068831d..152138f5dd 100644 --- a/src/ActionClasses.cpp +++ b/src/ActionClasses.cpp @@ -178,6 +178,7 @@ PlayPauseAction::PlayPauseAction( KActionCollection *ac, QObject *parent ) ac->addAction( QStringLiteral("play_pause"), this ); setText( i18n( "Play/Pause" ) ); setShortcut( Qt::Key_Space ); + KGlobalAccel::setGlobalShortcut( this, QKeySequence() ); EngineController *engine = The::engineController();
(In reply to Wolfgang Bauer from comment #7) > Yeah, the Increase/Decrease Volume shortcuts apparently have a different > problem, as Amarok seems to recognize the key press *once* (at least the > volume OSD pops up), only further presses have no effect. FTR, the local shortcuts (+ and - by default) do have the same problem...
PS: I meanwhile looked through https://cgit.kde.org/amarok.git/commit/?id=c3c4c7b8ebc4bc9ec94394f5d3a5569dee8b4725 (which ported all the KAction to QAction) and all other shortcuts (except Play/Pause) seem to have been ported correctly. Of course I may have overlooked someting, so please tell if you notice any other shortcut that's not working as expected.
(In reply to Wolfgang Bauer from comment #7) > I'll try to investigate more, but this might be trickier to figure out. The problem was simpler than I feared: https://phabricator.kde.org/D24413 I'll update the package when this was accepted. (although, I probably won't have time before Monday anyway)
This is an autogenerated message for OBS integration: This bug (1152751) was mentioned in https://build.opensuse.org/request/show/736815 Factory / amarok
This is an autogenerated message for OBS integration: This bug (1152751) was mentioned in https://build.opensuse.org/request/show/815548 15.2 / amarok
All problems mentioned here should be fixed meanwhile.