Bug 357194 - Chosen keyboard layout doesn't work when plasma-desktop reboots with fcitx5
Summary: Chosen keyboard layout doesn't work when plasma-desktop reboots with fcitx5
Status: RESOLVED UPSTREAM
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_keyboard (show other bugs)
Version: 6.1.5
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Andriy Rysin
URL:
Keywords:
: 373164 499656 500164 500591 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-12-26 23:25 UTC by korgens
Modified: 2025-03-22 02:31 UTC (History)
14 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description korgens 2015-12-26 23:25:13 UTC
After configuring the keyboard to Portuguese (Brazilian) and removing the English layout, it works nicely. However, after rebooting, the system goes back to the English layout, although System Settings still shows that the Portuguese keyboard is active. You must go into the configuration and change something (anything, it seems) to that the keys start (again) to work with the Portuguese layout. My guess is that this happens with other layouts, too.

Reproducible: Always

Steps to Reproduce:
1. Go to System Settings -> Hardware -> Input Devices -> Keyboard -> Layouts
2. Enable lyout configuration
3. Add a new keyboard layout (in my case, Portuguese, Brazil, br)
4. Remove the English layout
5. Apply the changes
6. Test the changes in the Hardware tab, inside the test area
7. Go back to All configurations
8. Close system settings
9. Perform a clean exit (shutdown) from the system, using the graphical menu.
10. Turn on the computer again
11. Login into plasma desktop
12. Open any application
13. Try to use any Portuguese from Brazil  specific layout  key, such as "ç". 
14. It was expected to have a "ç" character on screen, but we get ";" (which is the ";" location of standard English keyboards).
15. Go back to system settings and notice that only the Portuguese, Brazil, keyboard layout is selected.
16. go back to the Hardware tab, test area, and observe that the active layout is the English one (although it was removed from the system and the Portuguese, Brazil, one is selected).
17. Change anything or perform the selection again.
18. The correct layout works until the next reboot

Actual Results:  
The English keyboard layout is always active when the system initializes (after a cold boot or a reboot).

Expected Results:  
The selected Portuguese, Brazil, keyboard layout should be active at all times, including after reboots.

I've upgraded to Plasma 5 from KDE 4 when Archlinux dropped support for KDE 4. I've tried to manually erase all old KDE configuration files before performing the upgrade, just to be sure nothing would break.

My system is up-to-date as of today December, 22, 2015.

This is an annoying bug because there are other people on the house the use this system and they are not computer savvy enough to figure out how to change the keyboard layout.
Comment 1 Artur Puzio 2015-12-27 15:18:56 UTC
I'm running systemsettings 5.5.1 on Gentoo and I have followed your steps precisely without encountering any problems. I changed the leyout from Polish to Portuguese. Rebooted. It worked. Changed back. Rebooted. And mine worked again.
Seams like the bug was introduced in 5.5.2 or there is an problem with your setup. Someone else should test it on systemsettings 5.5.2.
Comment 2 korgens 2015-12-27 22:58:31 UTC
Somewhere during the upgrade from kde 4 to plasma 5 there was a question about udev or libinput or something. I'm not sure what I was supposed to choose...Maybe it is related.
Comment 3 korgens 2015-12-27 23:12:24 UTC
Additional minor information. While playing with the configuration I've noticed that if the checkbox named (I'm translating from Portuguese to English, so the actual name might be a little different) "Show keyboard indicator even if there is only one layout" is checked, when I reboot, it shows "en". 

The minor information part is that not only the system is using a layout that was removed, but it is also showing the "correct" name of that removed layout.
Comment 4 korgens 2015-12-29 23:54:07 UTC
I've seen that I didn't have an  /etc/X11/xorg.conf.d/00-keyboard.conf file so I've created one:

Section "InputClass"
  Identifier "system-keyboard"
  MatchIsKeyboard "on"
  Option "XkbLayout" "br"
  Option "XkbModel" "pc105"
EndSection

However, that didn't solve the issue, either.
Comment 5 Bruno Massa 2024-12-10 15:51:10 UTC
Same here using the latest KUBUNTU 24.10 (Oracular) with KDE 6.1.5. On every reboot, the layout resets to "en". I don't know if it's a coincidence, but I also use "pt-br" layout.
Comment 6 Bruno Massa 2024-12-18 04:23:48 UTC
*** Bug 373164 has been marked as a duplicate of this bug. ***
Comment 7 ojmt 2025-02-03 08:55:15 UTC
I have encountered the same Issue on Arch Linux(Endeavour OS).
I found this conversation: https://bbs.archlinux.org/viewtopic.php?id=284058 that seems to have found a workaround by setting the kxkbrc file as immutable once the desired configuration is active and seems to have narrowed down the issue to the kxkbrc file being reset on login.

I have tested a bit and can at least confirm that logging out of an account and logging in again is sufficient to replicate the bug on my end.
Comment 8 mrkiu 2025-02-04 23:08:49 UTC
I faced same issue and realized it is related to fcitx5. I remembered I noticed the issue the first time i also got a kde notification requesting to activate fcitx5 in virtual keyboard. fcitx5 default layout is set to US and erase the layout defined in kxkbrc file at each login.
I run fcitx5-configtool (you might need to install the package), defined the layout I want in the config screen and apply.
Now it's keeping the correct layout after re-login.
Comment 9 Konstantin 2025-02-08 07:59:04 UTC
(In reply to mrkiu from comment #8)
> I faced same issue and realized it is related to fcitx5. I remembered I
> noticed the issue the first time i also got a kde notification requesting to
> activate fcitx5 in virtual keyboard. fcitx5 default layout is set to US and
> erase the layout defined in kxkbrc file at each login.
> I run fcitx5-configtool (you might need to install the package), defined the
> layout I want in the config screen and apply.
> Now it's keeping the correct layout after re-login.

I don't understand how to configure this package (fcitx5-configtool). If I put 2 input methods there, then for some reason 1 becomes inactive, and 2 becomes active. Moreover, if I'm in Russian, then more than one keyboard shortcut doesn't work for me at all.

How do I make sure that I have English and Russian so that I can switch between them as before and the keyboard shortcuts always work?
Comment 10 TraceyC 2025-02-10 17:43:34 UTC
*** Bug 499656 has been marked as a duplicate of this bug. ***
Comment 11 TraceyC 2025-02-10 17:44:59 UTC
Confirming, since it affects multiple people
Comment 12 cwo 2025-02-11 22:15:26 UTC
> How do I make sure that I have English and Russian so that I can switch
> between them as before and the keyboard shortcuts always work?

Easiest way is to uninstall fcitx5. You don't need an input method to type English and Russian, regular keyboard layouts are absolutely enough. Input methods are relevant for languages that have way more characters than keys (think Chinese or Japanese where you have thousands of different characters that you need to be able to type). Without fcitx5, you can just use Plasma's keyboard layout configuration and it will remember the layouts.

If you do want to have fcitx5 installed, you need to configure everything in fcitx5 which is rather more complicated than the plasma default because it does so much more. fcitx5 needs to take over the keyboard configuration from Plasma so that switching between languages works with input methods. There is a separate System settings module for fcitx5 (kcm-fcitx5), and you will probably also want kimpanel through which you can setup fcitx5 as well. If you do, you can just ignore the keyboard configuration in Plasma itself; it will not apply.
Comment 13 cwo 2025-02-11 22:23:07 UTC
*** Bug 497898 has been marked as a duplicate of this bug. ***
Comment 14 Konstantin 2025-02-11 23:00:29 UTC
> Easiest way is to uninstall fcitx5.

The funny thing is that I didn't set it purposefully. It was installed automatically when the system was updated, and I thought it was necessary now. Fortunately, I deleted it and everything is working fine.

But I still wonder how it can be configured so that it works normally. Because it's either a mistake or something else. I set everything up correctly, but nothing worked properly.
Comment 15 Dmitri 2025-02-15 10:49:56 UTC
Have the similar issue since the last update, I suppose.
I've got 2 keyboard layout: 
 cat ~/.config/kxkbrc                                                                                                                        
[$Version]
update_info=kxkb_variants.upd:split-variants,kxkb.upd:remove-empty-lists,kxkb.upd:add-back-resetoptions

[Layout]
DisplayNames=,
LayoutList=ca,ru
LayoutLoopCount=-1
Options=terminate:ctrl_alt_bksp,grp:alt_shift_toggle
ResetOldOptions=true
ShowFlag=false
ShowLabel=true
ShowLayoutIndicator=true
ShowSingle=false
SwitchMode=Global
Use=true
VariantList=,

Each time after rebooting or logging out I can not switch to the russian layout. After startup I go to System Settings -> Keyboard -> Layouts and see the russian layout is present there but it the output is:
cat ~/.config/kxkbrc                                                                                                                   
[$Version]
update_info=kxkb_variants.upd:split-variants,kxkb.upd:remove-empty-lists,kxkb.upd:add-back-resetoptions

[Layout]
LayoutList=ca
LayoutLoopCount=-1
Options=terminate:ctrl_alt_bksp,grp:alt_shift_toggle
ResetOldOptions=true
ShowFlag=false
ShowLabel=true
ShowLayoutIndicator=true
ShowSingle=false
SwitchMode=Global
Use=true

I toggle off and on the Activate button (Layouts section) and the russian layout disappears from the list. 
--
Operating System: Manjaro Linux 
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.1
Kernel Version: 6.6.74-1-MANJARO (64-bit)
Graphics Platform: X11
Comment 16 cwo 2025-02-15 11:03:54 UTC
(In reply to Dmitri from comment #15)
> Have the similar issue since the last update, I suppose.

Do you have fcitx5 installed? If so, see comment 12.

If not, then you have a different issue. Please file a new bug report with this information, and make sure to include that you do not have fcitx5 installed so we know it's not related to that.
Comment 17 Dmitri 2025-02-15 11:31:25 UTC
(In reply to cwo from comment #16)
> (In reply to Dmitri from comment #15)
> > Have the similar issue since the last update, I suppose.
> 
> Do you have fcitx5 installed? If so, see comment 12.
> 
> If not, then you have a different issue. Please file a new bug report with
> this information, and make sure to include that you do not have fcitx5
> installed so we know it's not related to that.

I do. Thank you!
pacman -Qi fcitx5                                                                                                                
Nom                      : fcitx5
Version                  : 5.1.11-2
Description              : Next generation of fcitx
Architecture             : x86_64
URL                      : https://github.com/fcitx/fcitx5
Licences                 : LGPL-2.1-or-later AND Unicode-DFS-2016
Groupes                  : fcitx5-im
Fournit                  : --
Dépend de                : cairo  enchant  iso-codes  libgl  libxkbcommon-x11  pango  systemd  wayland  xcb-imdkit  xcb-util-wm  libxkbfile  gdk-pixbuf2
                           json-c
Dépendances opt.         : --
Requis par               : --
Optionnel pour           : --
Est en conflit avec      : fcitx
Remplace                 : --
Taille installée         : 17,25 MiB
Paqueteur                : Felix Yan <felixonmars@archlinux.org>
Compilé le               : mer. 18 déc. 2024 00:01:07
Installé le              : sam. 08 févr. 2025 20:23:56
Motif d’installation     : Installé comme dépendance d’un autre paquet
Script d’installation    : Non
Validé par               : Signature
Comment 18 cwo 2025-02-15 12:27:58 UTC
Then your options are as outlined in comment #12. Either uninstall fcitx5 if you do not actually need it, or use fcitx5 to configure your layouts and switching, not Plasma's keyboard settings in System Settings > Keyboard. fcitx5 takes over keyboard layouts when it's started, and replaces it with the ones configured in fcitx5 so that it can function properly. We know this is not optimal, but at the moment you cannot use Plasma's Keyboard layout configuration if you're also using fcitx5, it will be regularly overwritten.

(You can install kcm-fcitx5 if you want to configure fcitx5 in System Settings, but it will not appear in the Keyboard settings; it's under Language & Time as "Input Method").
Comment 19 Dmitri 2025-02-15 20:26:24 UTC
(In reply to cwo from comment #18)
> Then your options are as outlined in comment #12. Either uninstall fcitx5 if
> you do not actually need it, or use fcitx5 to configure your layouts and
> switching, not Plasma's keyboard settings in System Settings > Keyboard.
> fcitx5 takes over keyboard layouts when it's started, and replaces it with
> the ones configured in fcitx5 so that it can function properly. We know this
> is not optimal, but at the moment you cannot use Plasma's Keyboard layout
> configuration if you're also using fcitx5, it will be regularly overwritten.
> 
> (You can install kcm-fcitx5 if you want to configure fcitx5 in System
> Settings, but it will not appear in the Keyboard settings; it's under
> Language & Time as "Input Method").

It's very kind of you to explain all these things in details! Thanks again and have my best wishes.
Comment 20 T I Z E N 2025-02-16 09:03:43 UTC
Have the Same Issue, but havn´t seen this thread:

I also uninstalled the `fcitx5` 
> sudo pacman -R fcitx5

Source: https://bugs.kde.org/show_bug.cgi?id=500164

I also have send an Issue to the Repo of fcitx: https://github.com/fcitx/fcitx5/issues/1270
Comment 21 T I Z E N 2025-02-16 09:22:39 UTC
*** Bug 500164 has been marked as a duplicate of this bug. ***
Comment 22 T I Z E N 2025-02-16 10:28:08 UTC
*** Bug 500164 has been marked as a duplicate of this bug. ***
Comment 23 cwo 2025-02-22 21:29:01 UTC
*** Bug 500591 has been marked as a duplicate of this bug. ***
Comment 24 Nate Graham 2025-03-22 02:31:46 UTC
From what I can tell according to https://github.com/fcitx/fcitx5/issues/1261, this is an upstream issue in FCITX, where it takes over the keyboard layouts. It seems like it's possible to tell it to stop doing that.