Skip to content

Instantly share code, notes, and snippets.

@squeuei
Last active April 28, 2025 13:19
Show Gist options
  • Save squeuei/87334184966dc51946180858552bdbef to your computer and use it in GitHub Desktop.
Save squeuei/87334184966dc51946180858552bdbef to your computer and use it in GitHub Desktop.
Wayland, VSCode, and Fcitx5

What happened?

Sometimes Fcitx5 drops the very first keystroke, thus acting like direct input, when the user types quickly.

Environment

  • OS: Fedora 42 Workstation KDE Plasma Desktop
  • Editor: VSCode (official build)
  • Input Method Frontend: Fcitx5
  • Input Method Backend: anthy-unicode
  • KDE Virtual Keyboard: Fcitx5
  • $HOME/.config/code-flags.conf:
    --enable-features=UseOzonePlatform
    --ozone-platform=wayland
    --enable-wayland-ime
    --wayland-text-input-version=3
    --gtk-version=4
    

Solution

According to this documentation, make GTK3 use Fcitx:

echo 'gtk-im-module=fcitx' >> $HOME/.config/gtk-3.0/settings.ini

For other configuration details, follow the guide.

TL;DR: Set only XMODIFIERS=@im=fcitx as an environment variable in .profile, .bash_profile, or another appropriate startup file.

Bonus

If you want to use KDE Plasma + Wayland + VSCode + ibus, then set gtk-im-module=ibus on $HOME/.config/gtk-3.0/settings.ini. But I'm still not be able to convert to Japanese successfully with ibus.

現象

Fcitx5で速く日本語を打つと最初の一文字目が直接入力のように扱われる。

環境

  • OS: Fedora 42 Workstation KDE Plasma Desktop
  • エディタ: VSCode (公式ビルド)
  • IMEフロントエンド: Fcitx5
  • 変換エンジン: anthy-unicode
  • KDE 仮想キーボード: Fcitx5
  • $HOME/.config/code-flags.conf:
    --enable-features=UseOzonePlatform
    --ozone-platform=wayland
    --enable-wayland-ime
    --wayland-text-input-version=3
    --gtk-version=4
    

解決方法

この記事に従って、GTK3がFcitxを使うよう設定する:

echo 'gtk-im-module=fcitx' >> $HOME/.config/gtk-3.0/settings.ini

その他の設定はUsing Fcitx 5 on Wayland - Fcitxを参考に。要するに、.profile.bash_profileなどの適当なファイルでXMODIFIERS=@im=fcitxだけ環境変数として設定する。

おまけ

もしKDE Plasma + Wayland + VSCode + ibusで使いたいなら$HOME/.config/gtk-3.0/settings.inigtk-im-module=ibusを設定する。でも変換候補を出したところでおかしくなるので結局使えてない。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment