Bug 410110 - Spacebar to play/pause only works when using Elisa in English
Summary: Spacebar to play/pause only works when using Elisa in English
Status: RESOLVED FIXED
Alias: None
Product: Elisa
Classification: Applications
Component: general (show other bugs)
Version: 21.12.2
Platform: Arch Linux Linux
: HI major
Target Milestone: ---
Assignee: Nate Graham
URL:
Keywords: usability
: 429932 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-07-22 14:54 UTC by Matej Mrenica
Modified: 2022-03-08 23:12 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 22.04


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matej Mrenica 2019-07-22 14:54:30 UTC
SUMMARY
Pressing spacebar in Elisa doesn't do anything, IIRC it used to start/stop playing the current song.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.16.3
KDE Frameworks Version: 5.60
Qt Version: 5.13.0
Comment 1 Nate Graham 2019-07-23 16:36:11 UTC
Works for me FWIW.
Comment 2 Matej Mrenica 2019-07-23 17:14:59 UTC
I just tried this on kde neon unstable and it works correctly, so this is Arch-only bug or my-setup-only bug. Do you know what .config files might affect this (so I can delete them)?
Comment 3 Nate Graham 2019-07-23 17:40:55 UTC
I don't think there are any config files involved at all; this is hardcoded. But you can always try deleting ~/.config/elisarc.

I would recommend reporting this to the Arch packagers. Thanks!
Comment 4 Matej Mrenica 2019-07-24 06:11:45 UTC
I reported this in Arch bug tracker and I was sent back here: https://bugs.archlinux.org/task/63263

It looks like the issue is caused by Spacebar not being recognised if using a different language (and thus spacebar has different name).
Comment 5 Nate Graham 2019-07-24 13:52:12 UTC
Thanks, that's very helpful.
Comment 6 Nate Graham 2019-07-24 14:17:55 UTC
This patch (https://phabricator.kde.org/D22718) did not fix the issue for me when I tested it, but if you have the ability to test patches, can you give it a try too?
Comment 7 Matej Mrenica 2019-07-24 15:11:05 UTC
I tried the patch you made, but it didn't change anything.
Comment 8 Matej Mrenica 2019-07-24 16:09:16 UTC
Just to add, space-to-play/pause works only if English is the only set language. Having more languages set as preferred even though English is the first, doesn't work.
Comment 9 Nate Graham 2019-07-24 16:19:04 UTC
That sounds like it might be fallout from Bug 327757.
Comment 10 Matej Mrenica 2019-07-24 16:31:17 UTC
Yes that sounds exactly like that. If I set my languages to:
1. en_us
2. sk_sk

then Elisa uses the name of spacebar (in shortcut settings) from sk_sk language. 
And that might be why spacebar isn't recognised as spacebar.

Although it doesn't completely explain why spacebar doesn't work with sk_sk language only.
Comment 11 Nate Graham 2019-07-24 16:32:49 UTC
(In reply to mthw0 from comment #10)
> Although it doesn't completely explain why spacebar doesn't work with sk_sk
> language only.
Right, and that's why this specific bug is a separate issue from Bug 327757.
Comment 12 Patrick Silva 2020-02-10 16:44:19 UTC
I have american english and portuguese languages in regional settings.
Space bar works to play/pause music after I click outside of the search field even if
plasma/elisa language is portuguese.

elisa 19.12.2
Operating System: Arch Linux 
KDE Plasma Version: 5.17.90
KDE Frameworks Version: 5.67.0
Qt Version: 5.14.1
Comment 13 Nate Graham 2020-02-11 20:04:54 UTC
Matej, is this still reproducible for you with Elisa 19.12.0 when the search field isn't focused?
Comment 14 Matej Mrenica 2020-02-11 20:08:20 UTC
Yes it is.
Comment 15 Nate Graham 2020-02-11 20:08:58 UTC
Darn.
Comment 16 Matthieu Gallien 2020-03-21 23:35:31 UTC
(In reply to Matej Mrenica from comment #14)
> Yes it is.

I am sorry, but I have tested with 19.12.3 version and cannot reproduce if I start Elisa this way:

LANG=sk_SK.UTF-8 LANGUAGE=sk_SK ./elisa

The interface is correctly translated but spacebar works as long as a text entry is not focused.
Comment 17 Matej Mrenica 2020-03-22 08:56:15 UTC
I am now on a new computer and I don't have this issue anymore. There must be something messed up with the old setup. Even though the issue was not resolved I won't object if you decide to close this issue.
Comment 18 Matthieu Gallien 2020-03-22 10:07:58 UTC
Thanks for your answer.

Feel free to reopen the bug if you see this bug again.

Best regards
Comment 19 Nate Graham 2020-12-03 19:31:30 UTC
*** Bug 429932 has been marked as a duplicate of this bug. ***
Comment 20 Nate Graham 2020-12-03 19:32:02 UTC
Apparently this is still sometimes happening; see duplicate bug 429932 which involves a user with Elisa in German.
Comment 21 postix 2020-12-03 19:39:51 UTC
> which involves a user with Elisa in German.
This is me.

I just noticed that if I click in the "files" or "radio" section on the play button so that song/radio stream starts playing,
I can use the spacebar!

However, the song/radio stream only pauses for a fraction of a second and then continues playing. 

Once I select another UI element, the spacebar does nothing anymore.
Comment 22 Matej Mrenica 2020-12-03 20:35:45 UTC
I am assuming the name for Spacebar is translated in German translation, I remember changing the translation for Slovak so it's not translated and now It works correctly. But that might be just a coincidence, since I also changed computers.
Comment 23 postix 2020-12-03 20:37:33 UTC
(In reply to Matej Mrenica from comment #22)
> I am assuming the name for Spacebar is translated in German translation, I
> remember changing the translation for Slovak so it's not translated and now
> It works correctly.

Yes it is translated to "Leertaste".
Comment 24 Nate Graham 2020-12-03 20:43:49 UTC
Found the issue. Fixing shortly.
Comment 25 Nate Graham 2020-12-03 20:47:38 UTC
Git commit 904dc9fbdb007b3690dd58d77307679811256f3c by Nate Graham.
Committed on 03/12/2020 at 20:47.
Pushed by ngraham into branch 'release/20.12'.

Don't look for translated version of "Play-Pause" shortcut

Shortcuts should always use bare string literals instead of translations
because this causes issues in cases where the string has not been
translated in some languages, or when it gets customized before or after
the translation takes place.

This commit fixes the problem by always searching for the string literal.
FIXED-IN: 20.12.1

M  +1    -1    src/elisaapplication.cpp

https://invent.kde.org/multimedia/elisa/commit/904dc9fbdb007b3690dd58d77307679811256f3c
Comment 26 postix 2020-12-03 21:34:09 UTC
\o/ Thanks!
Comment 27 Nate Graham 2020-12-03 21:51:23 UTC
My pleasure!
Comment 28 postix 2021-02-03 14:25:50 UTC
I completely purged all traces of Elisa 20.08.x and reinstalled Elisa 20.12.1 and I still can reproduce the bug with a German locale. :-(
Comment 29 Matej Mrenica 2021-02-09 17:15:42 UTC
I used to have this issue, but not anymore. I also changed the translation so it's not translated anymore, so I am not sure what fixed it.
Comment 30 KDamian 2021-09-04 13:06:04 UTC
I can reproduce in Elisa 21.08.1 and system as below:

Operating System: KDE neon 5.22
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.3
Kernel Version: 5.11.0-27-generic (64-bit)
Graphics Platform: X11
Processors: 4 × Intel® Core™ i5-2520M CPU @ 2.50GHz
Memory: 7.7 GiB of RAM
Graphics Processor: Mesa DRI Intel® HD Graphics 3000



Problem does not appear when I start with LANG=en_US.UTF-8 LANGUAGE=en_US.
Comment 31 KDamian 2021-09-04 13:08:31 UTC
I forgot, to my last comment: I use Hungarian language and locale.
Comment 32 Nate Graham 2021-09-07 15:08:50 UTC
Can you please attach your ~/.config/elisarc file?
Comment 33 postix 2021-09-07 15:30:14 UTC
(In reply to Nate Graham from comment #32)
> Can you please attach your ~/.config/elisarc file?

In my case

Operating System: openSUSE Tumbleweed 20210904
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Elisa 21.08.1


> cat ~/.config/elisarc 
[ElisaFileIndexer]
RootPath[$e]=$HOME
Comment 34 KDamian 2021-09-07 16:10:06 UTC
(In reply to Nate Graham from comment #32)
> Can you please attach your ~/.config/elisarc file?

on my system:

[ElisaFileIndexer]
RootPath[$e]=$HOME/Zenék

[Views]
InitialView=Radios

Operating System: KDE neon 5.22
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.3
Kernel Version: 5.11.0-27-generic (64-bit)
Elisa 21.08.1
Comment 35 Nate Graham 2021-09-08 18:47:47 UTC
OK, so that's not relevant, then.
Comment 36 Bug Janitor Service 2022-03-06 23:58:54 UTC
A possibly relevant merge request was started @ https://invent.kde.org/multimedia/elisa/-/merge_requests/336
Comment 37 Nate Graham 2022-03-08 23:09:44 UTC
Git commit fd858caf0e780f74275c56f4083517ef9e8056b4 by Nate Graham, on behalf of Olivier Trichet.
Committed on 08/03/2022 at 23:08.
Pushed by ngraham into branch 'master'.

Fix shortcut not working under non English locale

This change wraps calls to QAction::shortcut() done in QML files
to use the portable representation of QKeySequence.

The QKeySequence to QVariant operator return a string
representation using the native format not the portable format.
E.g., the sequence "Space", will be "Espace" under French locale.
The 'shortcut' attribute of QtQuick Action is stored as QVariant.
In qml file, when the QAction::shortcut() value (a QKeySequence)
is affected to a QtQuick Action shortcut, the previous operator is
used and the shortcut value may be bogus depending on translation.

    // A QAction* with the Qt::Key_Space shortcut
    property var playPauseAction: ElisaApplication.action("Play-Pause")
    Action {
        // - playPauseAction.shortcut returns QKeySequence(Qt::Key_Space).
        // - QKeySequence(Qt::Key_Space) is transform into a QVariant that
        //        contains native text "Espace".
        // - this QVariant is affected to shortcut: broken.
        shortcut: playPauseAction.shortcut
        onTriggered: ElisaApplication.audioControl.playPause()
    }
Related: bug 424890

M  +6    -0    src/elisaapplication.cpp
M  +1    -0    src/elisaapplication.h
M  +6    -6    src/qml/ApplicationMenu.qml
M  +8    -8    src/qml/ElisaMainWindow.qml
M  +1    -1    src/qml/MediaPlayerControl.qml
M  +1    -1    src/qml/NativeMenuItemFromAction.qml
M  +7    -7    src/qml/NativeTrayMenu.qml

https://invent.kde.org/multimedia/elisa/commit/fd858caf0e780f74275c56f4083517ef9e8056b4