If you found fcitx is installed on your system unintentionally on an Arch Linux based distribution, including Manjaro, EndeavourOS, you may find it accidentally cleared all your keyboard layout settings on KDE.
If you never uses fcitx and have no interest on using it, simply run "pacman -Rc fcitx5" to uninstall it.
If you are wondering why it's happening, here is the explanation:
1. recently Arch dropped sdl2 and replaced it with sdl-compact.
2. sdl2 was uploaded to AUR because people still find it useful. sdl2's PKGBUILD on AUR, is just a copypaste version of Arch's offical ones.
3. The pkgbuild wrongly includes fcitx5 as its dependency. This is never correct. A few years ago fcitx4's lib, was an optional sdl dependency to make it support fcitx4. However, when I ported it to 2020, it's no longer using fcitx's lib, but purely based on libdbus. Arch packager didn't aware of the change, and carried it all the way along with sdl2 update and even wrongly bumped it to fcitx5. This wrong dependency, eventually is brought into the AUR's sdl2 PKGBUILD.
4. When people upgrade the system or install some package, with an AUR capable package manager tool, like pamac, it may(I use may here since it really depends on how user uses the tool) pull sdl2 from AUR instead of using the sdl-compact.
This is how you may install fcitx5 accidentally if you uses sdl2 from AUR. I left a comment on sdl2 AUR page to ask the current maintainer to fix it (no change was done at this point when I'm writing this). I also submitted a change to arch's sdl3 package to remove this wrong makedepends.
To explain why fcitx5 is messing with kde's layout settings:
fcitx5 on Arch, is packaged with an xdg autostart file. Which will start it upon login. fcitx itself, provides a unified solution to keyboard layout and input method. It needs to send layout to compositor to change the layout. On X11, this can be done with setxkbmap or write code to do the exact same thing as setxkbmap. On Plasma Wayland, the only way is to change kde's layout settings and ask kwin reload the config. While fcitx also supports multiple layouts switching, it does it by setting only 1 layout to kde at a time. This is how and why you may find the layout setting is being cleared.
As a mitigation to this incident, I added a change to make it not write layout to kde under wayland unless it is selected as the input method in virtual keyboard kcm in systemsettings. But this change will not be out until next fcitx5 release. (but note, it will still do setxkbmap thing if you run kde under X11).
There are ongoing discussion on how to integrate fcitx and other input method framworks to kde keyboard settings, but that's not implemented yet.
Hope Google or other search engine can index this post soon and help people who's confused about the situation.
Thanks,
Xuetian