Maliit doesn't work anymore after installing fcitx5 on openSUSE

I had IBus and Maliit installed on my system, and had Maliit configured as my input method in System Settings > Keyboard > Virtual Keyboard. Recently I installed Plasma Mobile and fcitx5, and spent a few hours using fcitx5 as my input method. However, now QT_IM_MODULE is exported as “fcitx” regardless of which input method I choose in Virtual Keyboard and I cannot get the Maliit virtual keyboard to show up when trying to input text. I have not been able to unset QT_IM_MODULE; I don’t know what’s setting it.

1 Like

Unfortunately they are mutually exclusive right now. This is a known limitation.

You’ll need to figure out for yourself what’s exporting QT_IM_MODULE, or where it’s happening. It’s possible that uninstalling the package will help, or maybe look in your bash profile/bashrc files to see if it put a little snippet in there to always export QT_IM_MODULE

I have looked in my bashrc and there is no ~/.pam_environment. I also recursively grepped /etc for any mentions of QT_IM_MODULE and didn’t find anything. Also, Maliit works in Plasma Mobile.

Hi I have been testing/using Maliit, fcitx5 and, a little, Ibus. And I have some observations.
First, Ibus and fcitx5 should not be installed together, one has to be chosen (it depends on your distro though, Debian/Ubuntu give less trouble as much as Arch for example).
Secondly, assuming you choose fcitx5, Maliit and fcitx5 works great together. What I mean by that is they can be installed at the same time, you can switch from one and the other with systemsettings. But, it is true that you can’t use simultaneously Maliit and fcitx5: for example to input special/CJK character with the use of Maliit.
Thirdly, QT_IM_MODULE is not a problem for Maliit, it can be set to fcitx and then you still can use Maliit, it is a problem for Ibus though.
Also, it is possible to switch between having the IME/VK activate or not with a shortcut: by configuring the shortcut in the entry in systray configuration).

@ngraham One thing that could be nice is having a way to easily switch between IM/VK (or activate one) like between fcitx5 and Maliit, through a shortcut or with a button/widget on the panel or desktop.

I also have IBus installed, which causes fcitx5 to work. I haven’t tested switching to IBus yet. However, I had both IBus and maliit installed together earlier and maliit had no issues.

What do you mean by ibus cause fcitx5 to work?
What distro do you use ? Wayland or X? It is not recommended to have different IME installed at the same time, like Ibus and fcitx5.
But on some system, there seems less conflict.

Also, on wayland and with kde to my experience fcitx5 work a lot better, it is logical as fcitx5 is build on qt. There is a near complete integration with kde, for example there is a kcm for fcitx5 (integration of fcitx5 configuration in systemsettings).

By the way for QT_IM_MODULE , you can look into ~/.config/environment.d/ it is directory used by systemd to define env variable, also used by kde (or sddm). Environment variable could also be set in ~/.profile or in case of zsh in ~/.zprofile (~/.zlogin) and ~/.zshenv.
There is global files in /etc/ too.

What do you mean by ibus cause fcitx5 to work?

I never said that.

By the way for QT_IM_MODULE , you can look into ~/.config/environment.d/ it is directory used by systemd to define env variable, also used by kde (or sddm). Environment variable could also be set in ~/.profile or in case of zsh in ~/.zprofile (~/.zlogin) and ~/.zshenv.

~/.config/environment.d doesn’t exist on my system. I also checked ~/.profile, and I recursively grepped all of /etc for QT_IM_MODULE. I’m on openSUSE.

Well you said:

so then I don’t understand what you mean.

I don’t have lot of experience with openSUSE. Did you look into yast? Maybe openSUSE has a particular way to set some env vars, some script for setting IME (Debian has some for example). But, the point was that having QT_IM_MODULE=fcitx should’nt pose problem for Maliit, at least it does not on my system. It conflict with IBus though. Do you prefer IBus or fcitx5 ?
On my experience with Arch system, it is better not to have both installed, choose one and uninstall the other. And fcitx5 seems more supported on kde especially with wayland.

For input methods to work properly, it must be unset, no matter what the input method is.

openSUSE probably sets the environment variables that were needed for X11 through some script that gets installed with a package, without the appropriate checks that they’re only set on X11. Fedora did that in the past, until it was noticed and removed.

So it is not good to have QT_IM_MODULE=fcitx ? same for GTK and GLFW? It is in the case of wayland?
I may have misuse some config advice for X11.
On my system they are set, I didn’t encounter conflict between. I will unset them though.
But you confirm that it is not a problem to have fcitx5 and maliit installed (not activated), right ? and we shouldn’t have ibus and fcitx5 installed simultaneously?

Yes.

Yes. Having them installed shouldn’t do anything on its own, only the one you select in the “virtual keyboard” settings page actually gets started by Plasma.

Thanks for the answer. In fact, I had them unset on my main computer (but not a touchscreen device so no use for Maliit).
I had conflict between ibus and fcitx5 though, on Arch, less on Ubuntu.

Do you think that it could be possible to have a shortcut/widget to switch between IM, mainly between Maliit and fcitx5 (or IBus)?

Side Note: systemsettings > Keyboard > Virtual Keyboard should be renamed Input Method (or something else), it is confusing.

Edit: In fact is there a way to change IM in the command line? Something to attach to a shortcut or else. With qdbus ? kwriteconfig6?

Oh, I have no idea what I meant to say there. But I have both IBus and fcitx5 installed and fcitx5 has been working.

Hi, fcitx dev here.

So it IS indeed a tricky question, since it’s really up to what distro you are using.
Every main distro has there own way of setting those environment variables, and what might surprise you is that, you don’t really need that if you’re using Wayland (Let’s just put Xwayland side at this point).

Fedora has imsettings, Debian has im-config, and Opensuse, while I don’t know the exact tool name, I believe it has ~/.xim which allows you load a predefined profile for input method.

And all those tools, doesn’t integrate with KDE’s “virtual keyboard” system settings and they just don’t aware of each other.

Since you’re using openSUSE, you might want to check if any file under /etc/X11/xim.d (even though it’s “X11” in path) load anything for you if you couldn’t figure out what sets QT_IM_MODULE for you.

And opensuse also respect “INPUT_METHOD” (an opensuse specific thing) to override the .xim profile based on language.

And, all those distro tool are kinds of “out of date” on what should be done for wayland.

Fcitx has a wiki page to describes how can you set those (not just environment variable but also some config files) to make it work for both X11, wayland, Xwayland.

https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland

If you just don’t need it to be perfect, you can try to see if you can unset QT_IM_MODULE it with ~/.bash_profile. and that way, all qt app running under wayland should go with native wayland input method protocol and no matter how you switch it in systemsettings at run time everything should work.

Fcitx also provides some tool to test what im module it gonna use and in the perfect setup the commands below should output this:

$ fcitx5-gtk3-immodule-probing 
GTK_IM_MODULE=wayland

$ GDK_BACKEND=x11 fcitx5-gtk3-immodule-probing 
GTK_IM_MODULE=fcitx

$ fcitx5-qt6-immodule-probing 
QT_QPA_PLATFORM=wayland
QT_IM_MODULE="wayland;fcitx"
IM_MODULE_CLASSNAME=QtWaylandClient::QWaylandInputContext

$ QT_QPA_PLATFORM=xcb fcitx5-qt6-immodule-probing
QT_QPA_PLATFORM=xcb
QT_IM_MODULES="wayland;fcitx"
IM_MODULE_CLASSNAME=fcitx::QFcitxPlatformInputContext

Regarding whether maliit, ibus, fcitx are mutually exclusive, yes, they are all frameworks.

If you’re ok to use an onscreen keyboard that works with fcitx5, there’s indeed something you can test (require some compilation) and it doesn’t work very well under wayland (Run it with QT_QPA_PLATFORM=xcb so it can work under wayland :slight_smile: ) https://gitee.com/openkylin/kylin-virtual-keyboard

Here’s a demo when I try it on steam deck (X11):

1 Like

openSUSE user here. IIRC, it’s systemd-inputmethod-generator that sets the environment variables.

I’ll try to set the environment variables to empty in ~/.xim then.

Actually it will not accept empty values. Is it fine to have GTK_IM_MODULE and QT_IM_MODULE be wayland?

After running zypper remove systemd-inputmethod-generator everything works as expected! Thanks!

(I don’t know what the proper solution here is, but I will try to bring this up to openSUSE devs and see what they say.)