Use Plasma 5.24 to type in Alacritty (Or any other text-input-v3 client) with Fcitx 5 on Wayland

Relationship between the input method server and applications under Fcitx5+KWin/Wayland

With the latest release of Plasma 5.24, the native wayland input method support in KWin is improved to support non-virtual keyboard input method like Fcitx 5. (There are lots of issues if you try to use zwp_input_method_v1 in 5.23).

This leads to a outcome that non-Gtk/Qt application using text-input-v3 can be used flawlessly under KWin Wayland. Though, there is some small step that you’ll need to follow.

First of all, I suggest you have most up-to-date Plasma 5.24 and Fcitx 5.0.14. I believe the distribution that picks up Plasma 5.24 should also have up-to-date Fcitx 5.

Next, you’ll need to make KWin Wayland to launch Fcitx 5. This is required because only the privileged client is allowed to talk to KWin on input method protocol. KWin will send a socket file descriptor to the input method and input method service need to use this socket to connect to KWin.

Thanks to a simple KCM, which is accessible from systemettings -> Virtual keyboard (Naming of the KCM is not so good, because it was designed for mobile phone to launch maliit initially.)

From there, just select Fcitx 5. This requires you to have up-to-date Fcitx 5 to make it show up in this KCM, because it requires a special new field in the Fcitx 5 desktop file.

Although kwin will launch input method in a pretty early stage, but there might still be some race condition if there is another mechanism (Like XDG autostart) to launch Fcitx 5. You can try to re-login to see if if works, if not, you may want to disable Fcitx 5’s own XDG autostart or what ever mechanism you’re using to launch Fcitx 5.

Theoretically you don’t need to re-login, KWin can reload it immediately after you apply the setting in systemsettings. I would just re-login to make sure everything it properly launched, then you should be good to go.

Hello world from Chinese Pinyin!

Should I keep setting GTK_IM_MODULE / QT_IM_MODULE / XMODIFIERS?

  1. QT_IM_MODULE
    Qt has text-input-v2 support which can be used if QT_IM_MODULE is empty, but it has some small issue regarding the preedit. Also, with current version of wayland input method protocol, there can be only one global input context for wayland. So right now it can be a problem if you want to use the “per-application” input state supported by Fcitx 5. But using Qt’s text-input protocol has one benefit, is that visually there won’t be blinking for input window.
  2. GTK_IM_MODULE
    Gtk has text-input-v3 support, but it’s preedit is poorly styled with bold font for highlight. Also, its surrounding text support is poorly implemented. So for now, using GTK_IM_MODULE=fcitx might still be good option if you want to have all Fcitx features.
  3. XMODIFIERS
    It’s required to support XWayland.
This entry was posted in Linux and tagged , , , , , , . Bookmark the permalink.

3 Responses to Use Plasma 5.24 to type in Alacritty (Or any other text-input-v3 client) with Fcitx 5 on Wayland

  1. uwu says:
    Firefox 95.0 Android 12

    thx for the post! im gonna install kde

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.