Bug 444569 - Keyboard layout shortcuts activate wrong language [regression]
Summary: Keyboard layout shortcuts activate wrong language [regression]
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_keyboard (show other bugs)
Version: 5.23.3
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Andrey
URL:
Keywords: regression
: 466053 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-10-28 22:45 UTC by Roman Odaisky
Modified: 2023-03-31 10:27 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.26


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Odaisky 2021-10-28 22:45:06 UTC
1. Set up three keyboard layouts, say, English, Ukrainian(winkeys) and Russian
2. Enable spare layouts with 2 main layouts
3. Set up keyboard shortcuts for each particular language

Expected behavior: the main layout switch key toggles between English and another language. I can press the shortcut for a particular language to specify which of the two Slavic languages should be paired with English for the time being.

Actual behavior: Cryptic. The shortcut for English works most of the time. When the main layouts are English and Russian, everything works. But when the main layouts are English and Ukrainian, the shortcuts for Russian and Ukrainian are swapped. If I press the shortcuts too often, they sometimes deviate from the above in unpredictable ways.

KDE 5.22.5 (Ubuntu 21.10)
This is a regression, 5.21.4 (Ubuntu 21.04) worked fine.
Comment 1 Nate Graham 2021-10-28 23:20:59 UTC
Can you upgrade to Plasma 5.23? Some issues with the keyboard shortcuts were addressed there.
Comment 2 Bug Janitor Service 2021-11-12 04:39:25 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 3 Andrey 2021-11-12 10:55:24 UTC
You mentioned spare layout, are you running X11?
Wayland session doesn't support spare layouts yet.
Comment 4 Roman Odaisky 2021-11-12 23:52:27 UTC
Unfortunately, no luck with 5.23.3 from ppa:kubuntu-ppa/backports. Behavior is still exactly the same.

Yes, X11.
Comment 5 Andrey 2021-11-13 00:23:33 UTC
I can guess what's happening - if we use spare layout first time, we change theirs order.
But the shortcuts do know nothing about it, and continue behave as if the order was the same.
Here you got the swapping.
Does it look possible?

Need to see if we can correct the shortcuts as well..
Comment 6 Roman Odaisky 2021-11-13 20:19:43 UTC
(In reply to Andrey from comment #5)
> I can guess what's happening - if we use spare layout first time, we change
> theirs order.
> But the shortcuts do know nothing about it, and continue behave as if the
> order was the same.
> Here you got the swapping.
> Does it look possible?

Well spotted. If I have English, Russian, Ukrainian, in that order, then activating Ukrainian switches the order to EN—UK—RU and, if the shortcuts are tied to the position of the layout on the list instead of the layout itself, that would cause the problem.

What changed since 5.21.4, where things worked well?
Comment 7 Andrey 2021-11-14 01:56:39 UTC
In 5.21.4 we had old layouts widget maybe?
They look a bit different, if you trouble to compare I can check for sure.
Comment 8 Andrey 2022-09-14 13:29:36 UTC
The fix is ongoing,
meanwhile, could someone confirm https://bugs.kde.org/show_bug.cgi?id=459098?
Comment 9 Bug Janitor Service 2022-09-14 16:22:54 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1148
Comment 10 Andrey 2022-09-16 23:21:28 UTC
Git commit 02325c521066eb0afd5f2656093e71ce46ae2538 by Andrey Butirsky.
Committed on 16/09/2022 at 23:21.
Pushed by butirsky into branch 'master'.

fix: Keyboard layout shortcuts activate wrong language

Fixes spare layout's shortcuts activating wrong layout after first use, see the bug for the details.

When we switch to a spare layout (by the shortcuts or via applet's menu), rearrangement of layouts happen - the spare one become the last in the main loop, preempting the previous one on it's place.  
Layouts-specific shortcut actions activate the layout by index which is hold in the action's data. Thus, the indexes should be adjusted accordingly.

M  +25   -2    kcms/keyboard/keyboard_daemon.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/02325c521066eb0afd5f2656093e71ce46ae2538
Comment 11 Andrey 2022-09-16 23:22:44 UTC
Git commit 2cb9201be1e3a3f3d8f8a040de19b6a5a7827538 by Andrey Butirsky.
Committed on 16/09/2022 at 23:22.
Pushed by butirsky into branch 'Plasma/5.26'.

fix: Keyboard layout shortcuts activate wrong language

Fixes spare layout's shortcuts activating wrong layout after the first
use, see the bug for the details.

When we switch to a spare layout (by the shortcuts or via applet's
menu), rearrangement of layouts happen - the spare one becomes the last
in the main loop, preempting the previous one on it's place.

Layouts-specific shortcut actions activate the layout by index which is
hold in the action's data. Thus, the indexes should be adjusted
accordingly.


(cherry picked from commit 7525b4a692ac4a13a29771568d3153b7505d75da)

M  +25   -2    kcms/keyboard/keyboard_daemon.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/2cb9201be1e3a3f3d8f8a040de19b6a5a7827538
Comment 12 Andrey 2023-02-19 15:50:27 UTC
*** Bug 466053 has been marked as a duplicate of this bug. ***
Comment 13 Andrey 2023-02-19 22:22:19 UTC
Git commit acd4fa1f74d752eba8c23ff5b325a9da6b3daf9c by Andrey Butirsky.
Committed on 19/02/2023 at 22:22.
Pushed by butirsky into branch 'Plasma/5.24'.

fix: Keyboard layout shortcuts activate wrong language

Fixes spare layout's shortcuts activating wrong layout after the first
use, see the bug for the details.

When we switch to a spare layout (by the shortcuts or via applet's
menu), rearrangement of layouts happen - the spare one becomes the last
in the main loop, preempting the previous one on it's place.

Layouts-specific shortcut actions activate the layout by index which is
hold in the action's data. Thus, the indexes should be adjusted
accordingly.


(cherry picked from commit 7525b4a692ac4a13a29771568d3153b7505d75da)

M  +25   -2    kcms/keyboard/keyboard_daemon.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/acd4fa1f74d752eba8c23ff5b325a9da6b3daf9c