Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

KDE Plasma Desktop overrides $QT_IM_MODULE, disabling fcitx. Wrong suggestion from fcitx-diagnose to fix this. #422

Open
lijikun opened this issue Nov 30, 2019 · 1 comment

Comments

@lijikun
Copy link

lijikun commented Nov 30, 2019

This is probably more of a bug of KDE Plasma or Debian's im-config, but I suggest fcitx provide some workaround (or at least more documentation) to make itself easier to set up under KDE.

I had this problem under fresh installs of Kubuntu 18.04 (Plasma 5.12.9 + Qt 5.9.5) and KDE Neon (Plasma 5.17.3, Qt 5.13.2). Fcitx version is 4.2.9.6-1.

When KDE starts, Plasma somehow unsets the QT_IM_MODULE (but not GTK_IM_MODULE) variable supposedly exported by /etc/profile.d/input-method-config.sh. As a result, fcitx only works for GTK (e.g. Chromium) but not Qt (e.g. Qt Creator, Konqueror or Konsole) apps.

Running fcitx-diagnose generated the following output (only the relevant part):

Qt:

  1. qt4 - ${QT4_IM_MODULE}:

    Please set environment variable QT_IM_MODULE to "fcitx" using the tool your distribution provides or add export QT_IM_MODULE=fcitx to your ~/.xprofile. See Input Method Related Environment Variables: QT_IM_MODULE.

  2. qt5 - ${QT_IM_MODULE}:

    Please set environment variable QT_IM_MODULE to "fcitx" using the tool your distribution provides or add export QT_IM_MODULE=fcitx to your ~/.xprofile. See Input Method Related Environment Variables: QT_IM_MODULE.

  3. Qt IM module files:

    Found unknown fcitx qt module: /usr/lib/x86_64-linux-gnu/qt5/plugins/kcm_fcitx.so.
    Found fcitx im module for Qt5: /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so.
    Found fcitx im module for Qt4: /usr/lib/x86_64-linux-gnu/qt4/plugins/inputmethods/qtim-fcitx.so.
    Found fcitx qt module: /usr/lib/x86_64-linux-gnu/fcitx/qt/libfcitx-libpinyin-dictmanager.so.

However, adding export QT_IM_MODULE=fcitx to ~/.xprofile per above information would not fix the problem for me.

Instead, this line should be added to a file fcitx.sh (any filename as long as it ends with .sh) in the folder ~/.config/plasma-workspace/env/. Per my test, it will correctly set the environment variable and fcitx will work as expected for Qt apps. Alternatively, this setup can be done in System Settings -> Workspace -> Startup and Shutdown -> Autostart. The script must have .sh suffix and its "Run On" needs to be set to "Before session startup".

I suggest updating fcitx-diagnose (and/or the info on fcitx-im.org) to provide the correct information for KDE Plasma users.

@CoelacanthusHex
Copy link

It should be a bug of Debian (or Ubuntu),
so I think the best solution is reporting the bug to Debian or Ubuntu.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants