title: “Archlinux 下 Fcitx5 无法在部分应用输入中文的问题” source: “https://blog.flowerinsnow.cn/p/archlinux-%E4%B8%8B-fcitx5-%E6%97%A0%E6%B3%95%E5%9C%A8%E9%83%A8%E5%88%86%E5%BA%94%E7%94%A8%E8%BE%93%E5%85%A5%E4%B8%AD%E6%96%87%E7%9A%84%E9%97%AE%E9%A2%98/" author:
- “冬花ice的专栏” published: 2025-05-16 created: 2026-01-15 description: “在安装了 Archlinux 并安装了 PlasmaKDE/Wayland、Fcitx5 虚拟键盘(输入法)后,我又通过安装了 QQ、微信、VSCode、IntelliJ IDEA、Minecraft 等应用,出现了一个问题:不能在它们里面使用 Fcitx5 输入中文了,下面是解决经验,仅供参考\n” tags:
- “clippings”
在安装了 Archlinux 并安装了 PlasmaKDE/Wayland、Fcitx5 虚拟键盘(输入法)后,我又通过安装了 QQ、微信、VSCode、IntelliJ IDEA、Minecraft 等应用,出现了一个问题:不能在它们里面使用 Fcitx5 输入中文了,下面是解决经验,仅供参考
注意
本方法适用于 Archlinux/Fcitx5/KDE Plasma/Wayland,并确定您已经配置好了输入法(如配置了虚拟键盘等)
通用解决方法:添加环境变量
最好添加三个环境变量,你可以不去理解它们,如果想要理解,请参阅相关文档(可以在 #参考资料 中参阅)
1
2
3
XMODIFIERS=@im=fcitx
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
您可以通过修改 /etc/environment ,或软件启动脚本,或软件内部设置实现它
例:启动命令行
您可以在命令前添加它们以添加应用程序的环境变量
bash
1
XMODIFIERS=@im=fcitx GTK_IM_MODULE=fcitx QT_IM_MODULE=fcitx your_command_here
对于 Electron 应用的解决方法
可以为 Electron 应用添加标记来修复这个问题,这个方法同样对 chromium 内核的应用有效
1
2
3
--enable-features=UseOzonePlatform
--ozone-platform-hint=wayland
--enable-wayland-ime
如果你是 Electron 应用遇到了这个问题,那么可以按照如下步骤添加启动 flags
一、确定标签配置文件
以 QQ 为例,我们可以查看它的启动脚本
/usr/bin/linuxqq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
if [ -d ~/.config/QQ/versions ]; then
find ~/.config/QQ/versions -name sharp-lib -type d -exec rm -r {} \; 2>/dev/null
find ~/.config/QQ/versions -name libssh2.so.1 -type f -exec rm {} \; 2>/dev/null
fi
rm -rf ~/.config/QQ/crash_files/*
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config}
if [ -f "${XDG_CONFIG_HOME}/qq-flags.conf" ](/tags/ -f "${XDG_CONFIG_HOME}/qq-flags.conf" /); then
mapfile -t QQ_USER_FLAGS <<<"$(grep -v '^#' "${XDG_CONFIG_HOME}/qq-flags.conf")"
echo "User flags:" ${QQ_USER_FLAGS[@]}
fi
exec /opt/QQ/qq ${QQ_USER_FLAGS[@]} "$@"
然后提取关键词 ${XDG_CONFIG_HOME}/qq-flags.conf ,这个就是该应用的标签配置文件
二、添加标签
编辑上面的获取的配置文件,如果不存在就创建一个,然后写入下面的内容
~/.config/qq-flags.conf
1
2
3
--enable-features=UseOzonePlatform
--ozone-platform-hint=wayland
--enable-wayland-ime
三、重启应用
重启应用,问题得到解决
参考资料
[1] Fcitx. FAQ[EB/OL]. (2024-11-22)[2025-05-18]. https://fcitx-im.org/wiki/FAQ
[2] Fcitx. Using Fcitx 5 on Wayland[EB/OL]. (2025-03-04)[2025-05-18]. https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland
[3] Fcitx. Input method related environment variables[EB/OL]. (2016-02-02)[2025-05-18]. https://fcitx-im.org/wiki/Input_method_related_environment_variables
[4] Lejia Chen. Fcitx input method doesn’t work in JetBrains IDEs on Linux[Z/OL]. (2024-11-13)[2025-05-18]. https://youtrack.jetbrains.com/articles/SUPPORT-A-718/Fcitx-input-method-doesnt-work-in-JetBrains-IDEs-on-Linux