Bug 501917 - Keyboard layout switching breaks if the first layout matches the system layout
Summary: Keyboard layout switching breaks if the first layout matches the system layout
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_keyboard (other bugs)
Version First Reported In: 6.3.3
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-23 17:33 UTC by Janne Grunau
Modified: 2025-05-19 07:58 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Janne Grunau 2025-03-23 17:33:53 UTC
When the first keyboard layout matches the system layout the keyboard layout systray button is missing and switching via shortcut (Meta+Alt+k) does not work. After modifying the order so that the system layout is not the first entry switching works as expected.

locatectl
|    VC Keymap: us
|    X11 Layout: us
|    X11 Model: applealu_iso

cat ~/.config/kxkbrc 
| [Layout]
| DisplayNames=,,
| LayoutList=us,eu,de
| Model=applealu_iso
| Use=true
| VariantList=mac,,nodeadkeys

After changing the order to

cat ~/.config/kxkbrc 
| [Layout]
| DisplayNames=,,
| LayoutList=eu,us,de
| Model=applealu_iso
| Use=true
| VariantList=,mac,nodeadkeys

everything works as expected.



STEPS TO REPRODUCE
1. Go to keyboard configuration in System Settings
2. Enable "Layouts" and add system layout
3. add another layout and apply

OBSERVED RESULT
Switching between the the layouts is not possible. no keyboard layout systray icon and the keyboard shortcut is not working either

EXPECTED RESULT
active layout is displayed in the systray icon and switching between different keyboard layouts works

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux Asahi Remix 41
KDE Plasma Version: 6.3.3
KDE Frameworks Version: 6.12.0
Qt Version: 6.8.2

ADDITIONAL INFORMATION
originally reported in https://discussion.fedoraproject.org/t/keyboard-layout-switching-stopped-working/146988
Comment 1 duha.bugs 2025-03-24 16:32:50 UTC
After first trying to reproduce this, I could partially. I was only able to switch to my non system language with the shortcut. The applet did work though, including clicking on it.

After resetting my settings to default and adding the languages again, I can no longer reproduce.

The settings I tried to reproduce with:
localectl
System Locale: LANG=en_US.UTF-8
    VC Keymap: us
   X11 Layout: us
    X11 Model: pc105+inet
  X11 Options: terminate:ctrl_alt_bksp

cat ~/.config/kxkbrc 

[$Version]
update_info=kxkb.upd:remove-empty-lists,kxkb.upd:add-back-resetoptions,kxkb_variants.upd:split-variants

[Layout]
DisplayNames=,
LayoutList=us,de
Use=true
VariantList=,


What [$Version] do you get in your ~/.config/kxkbrc ?
Comment 2 Janne Grunau 2025-03-24 20:24:15 UTC
(In reply to duha.bugs from comment #1)
>
> What [$Version] do you get in your ~/.config/kxkbrc ?

none. The reported contents of ~/.config/kxkbrc are complete. It was always just the "Layout" section. In addition "Options=" in the Layout section have no effect as well in the broken system layout is first case.

The issue does *not* reproduce on my desktop with identical software. Settings there:
$localectl 
System Locale: LANG=en_US.UTF-8
    VC Keymap: us
   X11 Layout: (unset)         
$ cat ~/.config/kxkbrc  
[$Version]
update_info=kxkb.upd:remove-empty-lists,kxkb.upd:add-back-resetoptions,kxkb_variants.upd:split-variants

[Layout]
DisplayNames=,,
LayoutList=us,eu,de
Options=caps:ctrl_modifier
ResetOldOptions=true
Use=true
VariantList=euro,,nodeadkeys
Comment 3 Konstantin Pereiaslov 2025-05-19 06:45:17 UTC
I also have this issue. On boot layout switching doesn't work until I go to and adjust some settings, I haven't quite figure out which setting makes it work again. It started happening around the time of upgrade to 6.3.


Contents of ~/.config/kxkbrc:
[$Version]
update_info=kxkb_variants.upd:split-variants,kxkb.upd:remove-empty-lists,kxkb.upd:add-back-resetoptions

[Layout]
DisplayNames=,
LayoutList=us,ru
LayoutLoopCount=-1
Model=pc101
Options=grp:caps_toggle,grp_led:scroll,terminate:ctrl_alt_bksp,altwin:meta_win
ResetOldOptions=true
ShowFlag=true
ShowLabel=false
ShowLayoutIndicator=true
ShowSingle=false
SwitchMode=Global
Use=true
VariantList=,
Comment 4 Wismill 2025-05-19 07:35:22 UTC
(In reply to Janne Grunau from comment #2)
> The issue does *not* reproduce on my desktop with identical software.
> Settings there:
> $localectl 
> System Locale: LANG=en_US.UTF-8
>     VC Keymap: us
>    X11 Layout: (unset)         
> $ cat ~/.config/kxkbrc  
> [$Version]
> update_info=kxkb.upd:remove-empty-lists,kxkb.upd:add-back-resetoptions,
> kxkb_variants.upd:split-variants
> 
> [Layout]
> DisplayNames=,,
> LayoutList=us,eu,de
> Options=caps:ctrl_modifier
> ResetOldOptions=true
> Use=true
> VariantList=euro,,nodeadkeys

The original bug is likely due to https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/issues/112, which is fixed in xkeyboard-config-2.44.

You cannot reproduce because you do not have the same config: your `model` is not set, so it will default to `pc104`.
Comment 5 Janne Grunau 2025-05-19 07:58:36 UTC
Doesn't reproduce anymore on on Fedora 42 with KDE Plasma 6.3.5 / Frameworks 6.14.0 and xkeyboard-config-2.44-1.fc42