Bug 432367 - Keyboard layout's variant for the first layout is not applied
Summary: Keyboard layout's variant for the first layout is not applied
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: input (show other bugs)
Version: 5.20.90
Platform: Other Linux
: VHI normal
Target Milestone: ---
Assignee: Andrey
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-02-01 00:01 UTC by Leonard Lausen
Modified: 2021-02-12 15:40 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.21
Sentry Crash Report:
butirsky: Wayland+
butirsky: X11-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leonard Lausen 2021-02-01 00:01:19 UTC
SUMMARY
After updatin from Plasma 5.20 to 5.21 beta, German Neo2 Layout stops working and the standard German keyboard layout is used instead.

STEPS TO REPRODUCE
1. Go to keyboard layout settings
2. Add German (Neo 2) variant
3. Enable the variant and press the key corresponding to a in qwerty. input a is registered instead of expected input u (cf https://neo-layout.org/)

OBSERVED RESULT
Inputs registered are based on standard German keyboard variant

EXPECTED RESULT
Inputs registered are based on Neo 2 German keyboard variant

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Gentoo with Plasma 5.21 Beta
KDE Plasma Version: 5.20.90
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
I'm using wayland
Comment 1 Andrey 2021-02-01 22:55:47 UTC
Thanks Leonard for reporting and Nate for forwarding.

Leonard, I'm sorry for inconvenience, this is a known problem I currently have in mind, I hoped I could fix it before somebody faced it so I wouldn't have to report the bug, but is didn't happened :)

The thing is variants of the first layout currently do not work.
So as a workaround I could suggest please don't place your Neo layout to the first position. The Layout Settings have Move Up/Down buttons to change layout order. On the first position, place something that doesn't need variants.

Please report if the workaround works for you.
I'm sorry again and hope it doesn't break your workflow much.
The fix should be soon.
Comment 2 Leonard Lausen 2021-02-01 23:28:02 UTC
Thank you Andrey for your work on the Plasma Wayland code and for pointing out the workaround. The workaround works almost. The only major issue I face now is that the right Alt key no longer works for activating layer 4 of the layout (cf https://neo-layout.org/ "Ebene 4" in the picture in the upper right corner). Pressing the Right Alt key does not perform any action.

For example, Pressing "Right-Alt + D" should result in "Arrow down", but with your workaround results in "a" (which is the expected result of pressing "D" but not for "Right-Alt + D").

A second minor issue I find is that switching keyboard layouts via the shortcut ("Right-Ctrl+Right-Shift" in my case) does not work reliably anymore after moving neo layout to second position.
Comment 3 Leonard Lausen 2021-02-01 23:33:08 UTC
Specifically, I can activate the neo2 layout via the shortcut fine (Pressing "Right-Ctrl+Right-Shift" switches from US layout to neo2), but pressing the shortcut again does not switch back to US layout.
Comment 4 Andrey 2021-02-02 00:18:35 UTC
Leonard, this is probably because the shortcuts of these layouts do not match.
I wonder if you had similar problems with the same layouts but in different order?
Comment 5 Andrey 2021-02-02 11:47:44 UTC
So if it worked for you earlier, maybe it was on X11?
It works differently there, see bug 375518.

We could check it right now:
add 3 layouts in different order, and watch how it behaves on the shortcuts:
E.g.: US, US, Neo -> US, Neo, US

So probably we have 2 different issues here, the first one with the variants of the first layout which is the regression indeed, and the second is bug 375518 which is by design and was always there, and only might change in the future.

Let's track the regression here.
Comment 6 Leonard Lausen 2021-02-02 12:11:26 UTC
> Leonard, this is probably because the shortcuts of these layouts do not match.
> I wonder if you had similar problems with the same layouts but in different order?

The problem does not occur when using Default variant for German or placing the German Neo variant on position 1 and US on 2.

> So if it worked for you earlier, maybe it was on X11?

No, I was using Wayland with Plasma 5.20 and I haven't noticed this problem there. In fact the Right-Shift and Right-Ctrl key used as shortcut by me do not differ between the US and Neo. Thus I don't think it's related to 375518.

If you like, I can reinstall kwin 5.20 and double check that the shortcut works fine there.

> We could check it right now:
> add 3 layouts in different order, and watch how it behaves on the shortcuts:
> E.g.: US, US, Neo -> US, Neo, US

With 4 layouts:
English US, English UK, German Neo, German Default 
I can switch from US to UK to Neo, but then get stuck.

I also notice that switching from US to UK, the overlay notifying me about the new layout shows up immediately. For UK to Neo, the overlay does not show up until I switch the application in focus (eg to my browser where I am writing the bug report now)
Comment 7 Leonard Lausen 2021-02-02 14:25:11 UTC
In Plasma 5.20, if I use Neo as 1st layout and US as 2nd layout, I can switch between them via "Right-Ctrl + Right-Shift" without getting stuck. But once placing Neo as layout 2 and US as layout 1, switching will get stuck once selecting Neo.

Further I notice that the problem with "Alt key can no longer activate layer 4 (Ebene 4)" is also present on Plasma 5.20 if Neo is selected as 2nd layout. However, Alt key works correctly as long as Neo is selected as 1st layout.

Thus I think the only regression here is "variants of the first layout" support. The others are separate bugs related to difference in handling of 1st and n-th layout. Are these known issues?
Comment 8 Andrey 2021-02-02 19:23:27 UTC
(In reply to Leonard Lausen from comment #7)
> In Plasma 5.20, if I use Neo as 1st layout and US as 2nd layout, I can
> switch between them via "Right-Ctrl + Right-Shift" without getting stuck.
> But once placing Neo as layout 2 and US as layout 1, switching will get
> stuck once selecting Neo.
Thanks for testing. Actually I can't explain right now why the order of layouts matters for the shortcut functionality.
It would be good if you could check on X11 also.

> Thus I think the only regression here is "variants of the first layout"
> support. The others are separate bugs related to difference in handling of
> 1st and n-th layout. Are these known issues?
Bug 375518 is the only known to me (it has duplicate).
For any other issues you faced here, please open a separate reports and add me to CC. It might be you've found something new.
Thanks.
Comment 9 Andrey 2021-02-02 19:58:07 UTC
Oh, the other workaround I forgot to mention:
just add some variants to both layouts.
Comment 10 Leonard Lausen 2021-02-02 21:11:01 UTC
> Thanks for testing. Actually I can't explain right now why the order of layouts matters for the shortcut functionality.
> It would be good if you could check on X11 also.

I confirmed that also Plasma 5.20 X11 session, if I use Neo as 1st layout and US as 2nd layout, I can switch between them via "Right-Ctrl + Right-Shift" without getting stuck. But once placing Neo as layout 2 and US as layout 1, switching will get stuck once selecting Neo.
Comment 11 Leonard Lausen 2021-02-02 21:16:29 UTC
Reported as https://bugs.kde.org/show_bug.cgi?id=432436
Comment 12 Leonard Lausen 2021-02-03 00:59:17 UTC
> Oh, the other workaround I forgot to mention:
> just add some variants to both layouts.

I compiled 5.20.90 again and Neo variant does work fine now even when on position 1. I assume this is because I manually selected "Default" variant for US English while I was still on 5.20 (ie. both layouts now have a variant configured)

I'll not touch the setting for as not to risk any problems :) Please let me know once you have a patch that fixes the regression and I'm happy to do further testing.
Comment 13 Bug Janitor Service 2021-02-04 17:54:04 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/340
Comment 14 Andrey 2021-02-08 15:32:15 UTC
Git commit 5cbac50fdb71a17ae60a6f9433541f6e8675eee2 by Andrey Butirsky.
Committed on 08/02/2021 at 15:31.
Pushed by butirsky into branch 'master'.

fix: the first keyboard layout can't have variants

We need trailing comma in case of multiple layouts but only one variant,
see https://github.com/xkbcommon/libxkbcommon/issues/208

M  +3    -1    kcms/keyboard/keyboard_config.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/5cbac50fdb71a17ae60a6f9433541f6e8675eee2
Comment 15 Andrey 2021-02-08 15:33:18 UTC
Git commit b9eae656c7b4b16d2d0bb638a76a0197a74a1b8f by Andrey Butirsky.
Committed on 08/02/2021 at 15:33.
Pushed by butirsky into branch 'Plasma/5.21'.

fix: the first keyboard layout can't have variants

We need trailing comma in case of multiple layouts but only one variant,
see https://github.com/xkbcommon/libxkbcommon/issues/208


(cherry picked from commit 5cbac50fdb71a17ae60a6f9433541f6e8675eee2)

M  +3    -1    kcms/keyboard/keyboard_config.cpp

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