Fcitx5 共享输入状态异常

设置了不同应用使用独立输入状态, 鼠标点击窗口切换的时候正常, 但使用Alt+Tab 切换窗口会出现一些奇怪的行为

示例: Firefox和Ghostty切换, Firefox开启输入法, Ghostty关闭(英文)

在Firefox切换到Ghostty, Ghostty的输入法也被激活, 但按一下alt就恢复关闭状态了

cat .config/fcitx5/config:

[Hotkey]
# 按住切换键的修饰键时进行轮换切换
EnumerateWithTriggerKeys=True
# 激活输入法
ActivateKeys=
# 取消激活输入法
DeactivateKeys=
# 临时切换输入法
AltTriggerKeys=
# 向前切换输入法
EnumerateForwardKeys=
# 向后切换输入法
EnumerateBackwardKeys=
# 轮换输入法时跳过第一个输入法
EnumerateSkipFirst=False
# 触发修饰键快捷键的时限 (毫秒)
ModifierOnlyKeyTimeout=250

[Hotkey/TriggerKeys]
0=Super+space

[Hotkey/EnumerateGroupForwardKeys]
0=Super+space

[Hotkey/EnumerateGroupBackwardKeys]
0=Shift+Super+space

[Hotkey/PrevPage]
0=Up

[Hotkey/NextPage]
0=Down

[Hotkey/PrevCandidate]
0=Shift+Tab

[Hotkey/NextCandidate]
0=Tab

[Hotkey/TogglePreedit]
0=Control+Alt+P

[Behavior]
# 默认状态为激活
ActiveByDefault=False
# 重新聚焦时重置状态
resetStateWhenFocusIn=No
# 共享输入状态
ShareInputState=No
# 在程序中显示预编辑文本
PreeditEnabledByDefault=True
# 切换输入法时显示输入法信息
ShowInputMethodInformation=True
# 在焦点更改时显示输入法信息
showInputMethodInformationWhenFocusIn=True
# 显示紧凑的输入法信息
CompactInputMethodInformation=True
# 显示第一个输入法的信息
ShowFirstInputMethodInformation=True
# 默认页大小
DefaultPageSize=5
# 覆盖 XKB 选项
OverrideXkbOption=False
# 自定义 XKB 选项
CustomXkbOption=
# Force Enabled Addons
EnabledAddons=
# Force Disabled Addons
DisabledAddons=
# Preload input method to be used by default
PreloadInputMethod=True
# 允许在密码框中使用输入法
AllowInputMethodForPassword=False
# 输入密码时显示预编辑文本
ShowPreeditForPassword=False
# 保存用户数据的时间间隔(以分钟为单位)
AutoSavePeriod=30

环境变量

@/etc/environment
#
# This file is parsed by pam_env module
#
# Syntax: simple "KEY=VAL" pairs on separate lines
#

XMODIFIERS=@im=fcitx
GTK_IM_MODULE=fcitx
QT_IM_MODULES="wayland;fcitx"
SDL_IM_MODULE=fcitx
GLFW_IM_MODULE=fcitx

fcitx5-diagnose:

# 系统信息:
1.  `uname -a`:

        Linux archlinux 6.19.8-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Sat, 14 Mar 2026 01:07:31 +0000 x86_64 GNU/Linux

2.  `lsb_release -a`:

        LSB Version:	n/a
        Distributor ID:	Arch
        Description:	Arch Linux
        Release:	rolling
        Codename:	n/a

3.  `lsb_release -d`:

        Description:	Arch Linux

4.  `/etc/lsb-release`:

        DISTRIB_ID="Arch"
        DISTRIB_RELEASE="rolling"
        DISTRIB_DESCRIPTION="Arch Linux"

5.  `/etc/os-release`:

        NAME="Arch Linux"
        PRETTY_NAME="Arch Linux"
        ID=arch
        BUILD_ID=rolling
        ANSI_COLOR="38;2;23;147;209"
        HOME_URL="https://archlinux.org/"
        DOCUMENTATION_URL="https://wiki.archlinux.org/"
        SUPPORT_URL="https://bbs.archlinux.org/"
        BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues"
        PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
        LOGO=archlinux-logo

6.  桌面环境:

    桌面环境为 `kde`。

7.  XDG 会话类型:

        XDG_SESSION_TYPE='wayland'

8.  Bash 版本:

        BASH_VERSION='5.3.9(1)-release'

# 环境:
1.  DISPLAY:

        DISPLAY=':1'


        WAYLAND_DISPLAY='wayland-0'

2.  键盘布局:

    1.  `setxkbmap`:

            WARNING: Running setxkbmap against an Xwayland server
            xkb_keymap {
            	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
            	xkb_types     { include "complete"	};
            	xkb_compat    { include "complete"	};
            	xkb_symbols   { include "pc+us+inet(evdev)"	};
            	xkb_geometry  { include "pc(pc105)"	};
            };

    2.  `xprop`:

            _XKB_RULES_NAMES(STRING) = "evdev", "pc105", "us", "", ""

3.  Locale:

    1.  全部可用 locale:

            C
            C.utf8
            en_US.utf8
            POSIX
            zh_CN.utf8

    2.  当前 locale:

            LANG=zh_CN.UTF-8
            LC_CTYPE="zh_CN.UTF-8"
            LC_NUMERIC="zh_CN.UTF-8"
            LC_TIME="zh_CN.UTF-8"
            LC_COLLATE="zh_CN.UTF-8"
            LC_MONETARY="zh_CN.UTF-8"
            LC_MESSAGES="zh_CN.UTF-8"
            LC_PAPER="zh_CN.UTF-8"
            LC_NAME="zh_CN.UTF-8"
            LC_ADDRESS="zh_CN.UTF-8"
            LC_TELEPHONE="zh_CN.UTF-8"
            LC_MEASUREMENT="zh_CN.UTF-8"
            LC_IDENTIFICATION="zh_CN.UTF-8"
            LC_ALL=zh_CN.UTF-8

4.  目录:

    1.  主目录:

            /home/butter

    2.  `${XDG_CONFIG_HOME}`:

        环境变量 `XDG_CONFIG_HOME` 没有设定。

        `XDG_CONFIG_HOME` 的当前值是 `~/.config` (`/home/butter/.config`)。

    3.  Fcitx5 设置目录:

        当前 fcitx5 设置目录是 `~/.config/fcitx5` (`/home/butter/.config/fcitx5`)。

5.  当前用户:

    脚本作为 butter (1000) 运行。

# Fcitx 状态:
1.  可执行文件:

    在 `/usr/bin/fcitx5` 找到了 fcitx5。

2.  版本:

    Fcitx 版本: `5.1.19`

3.  进程:

    找到了 3 个 fcitx5 进程:

          70191 fcitx5-wayland-
          70192 fcitx5
          70267 fcitx5-plasma-t

4.  `fcitx5-remote`:

    `fcitx5-remote` 工作正常。

5.  DBus 界面:

    使用 `dbus-send` 来检查 dbus。

    DBus 名称 `org.fcitx.Fcitx5` 的所有者是 `:1.16220`。

    DBus 名称 `org.fcitx.Fcitx5` 的 PID 所有者是 `70192`。

    来自 dbus 的调试信息:

           Group [x11::1] has 1 InputContext(s)
          IC [a690dca756164ca0872ef758ec8fd1a2] program:qq frontend:dbus cap:6000000032 focus:0
        Group [wayland:] has 20 InputContext(s)
          IC [b017d1bcc74244c5856e35e0f5680d7b] program: frontend:dbus cap:c001000032 focus:1
          IC [0bee9d1193624754948ba1840a1530d2] program:keepassxc frontend:dbus cap:1e001800072 focus:0
          IC [d186e02538d64737bdf31a826fdfd211] program:org.keepassxc.KeePassXC frontend:wayland cap:200072 focus:0
          IC [abd2f74551e245698556548e40cb5773] program:org.mozilla.Thunderbird frontend:dbus cap:e001000072 focus:0
          IC [f0ad9568661747589ea50266891c71f2] program:keepassxc frontend:dbus cap:1e001800072 focus:0
          IC [a8aa5298f2c54d18b1a6798225333902] program:org.mozilla.Thunderbird frontend:dbus cap:6001000032 focus:0
          IC [593278e6568743a6b046acf18c5437fc] program:qq frontend:wayland cap:200072 focus:0
          IC [0ad996420bcf4ed897d09f311d017402] program:org.mozilla.Thunderbird frontend:wayland cap:200072 focus:0
          IC [2ff64a3123be45d2a0d09c1d00b7084d] program:firefox frontend:wayland cap:200072 focus:0
          IC [48bca0556f004ed6b885237bd6a8b54c] program:firefox frontend:dbus cap:e001000072 focus:0
          IC [e8cac508b45043aa97211dc300c46493] program:nvim-qt frontend:wayland cap:d0072 focus:0
          IC [d69356dee7474a54be8ac0e0a9ab0fb0] program:org.kde.dolphin frontend:wayland cap:d0072 focus:0
          IC [22d450ba233d440290f971c59d6960e3] program:firefox frontend:dbus cap:6001000032 focus:0
          IC [b382ddce814b428eb442b49ec65b6031] program:com.mitchellh.ghostty frontend:wayland cap:200072 focus:0
          IC [0f160312555546a6a812c6f846ae6ecc] program: frontend:dbus cap:c001000032 focus:0
          IC [acc4955103b54b4f8d23e122be935baa] program:org.kde.plasma-systemmonitor frontend:wayland cap:d0072 focus:0
          IC [f890f0a490e5476187881ab3c0f1661b] program:org.kde.spectacle frontend:wayland cap:d0072 focus:0
          IC [a5fa1cfc90144441bfc5f69a19000384] program: frontend:wayland cap:200072 focus:0
          IC [4351f66928d24e7ebcca0cdc31fe526e] program:obsidian frontend:wayland cap:200072 focus:0
          IC [d2d4bab62dfe4460a8bb173c8eae56e3] program:systemsettings frontend:wayland cap:200072 focus:0
        Input Context without group

# 前端设置:
此脚本检查的环境变量仅能显示当前命令行的环境。仍有可能您的环境并没有应用于整个桌面。您可以通过使用命令对某个无法正常工作的进程使用命令 `xargs -0 -L1 /proc/$PID/environ` 检查此进程的实际的环境变量。

## Xim:
1.  `${XMODIFIERS}`:

    环境变量 XMODIFIERS 已经正确地设为了“@im=fcitx”。
    从环境变量中获取的 Xim 服务名称为 fcitx.

2.  根窗口上的 XIM_SERVERS:

    Xim 服务的名称与环境变量中设置的相同。

## Qt:
1.  qt4 - `${QT4_IM_MODULE}`:

    环境变量 QT_IM_MODULE 已经正确地设为了“fcitx”。

    **`fcitx5-qt4-immodule-probing` 未找到.**

2.  qt5 - `${QT_IM_MODULE}`:

    环境变量 QT_IM_MODULE 已经正确地设为了“fcitx”。

    使用 fcitx5-qt5-immodule-probing 来检查在当前环境下将被实际使用的输入法模块:

        QT_QPA_PLATFORM=wayland
        QT_IM_MODULE=fcitx
        IM_MODULE_CLASSNAME=fcitx::QFcitxPlatformInputContext

3.  qt6 - `${QT_IM_MODULE}`:

    环境变量 QT_IM_MODULE 已经正确地设为了“fcitx”。

    使用 fcitx5-qt6-immodule-probing 来检查在当前环境下将被实际使用的输入法模块:

        QT_QPA_PLATFORM=wayland
        QT_IM_MODULES="wayland;fcitx"
        IM_MODULE_CLASSNAME=QtWaylandClient::QWaylandInputContext

4.  Qt 输入法模块文件:

    找到了 fcitx5 的 qt6 输入法模块:`/usr/lib/qt6/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so`。
    找到了未知的 fcitx qt 模块:`/usr/lib/qt6/plugins/plasma/kcms/systemsettings/kcm_fcitx5.so`。
    找到了 fcitx5 qt6 模块:`/usr/lib/fcitx5/qt6/libfcitx-quickphrase-editor5.so`。
    找到了 fcitx5 的 qt 输入法模块:`/usr/lib/qt/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so`。

    下列错误也许并不准确,因为对路径所对应的 Qt 版本的猜测取决于发行版如何打包 Qt。如果您不使用任何对应版本的 Qt 程序,或者在 Wayland 下使用 Qt 的 text-input 支持,下列错误也不是严重问题。
    **无法找到 Qt4 的 fcitx5 输入法模块。**

## Gtk:
1.  gtk - `${GTK_IM_MODULE}`:

    环境变量 GTK_IM_MODULE 已经正确地设为了“fcitx”。

    **`fcitx5-gtk2-immodule-probing` 未找到.**

    使用 fcitx5-gtk3-immodule-probing 来检查在当前环境下将被实际使用的输入法模块:

        GTK_IM_MODULE=fcitx

    使用 fcitx5-gtk4-immodule-probing 来检查在当前环境下将被实际使用的输入法模块:

        GTK_IM_MODULE=fcitx

2.  `gtk-query-immodules`:

    1.  gtk 2:

        在 `/usr/bin/gtk-query-immodules-2.0` 找到了 gtk `2.24.33` 的 `gtk-query-immodules`。
        版本行:

            # Created by /usr/bin/gtk-query-immodules-2.0 from gtk+-2.24.33

        **无法在 `/usr/bin/gtk-query-immodules-2.0` 的输出中找到 fcitx5。**

        **无法找到 gtk 2 的 fcitx5 输入法模块。**

    2.  gtk 3:

        在 `/usr/bin/gtk-query-immodules-3.0` 找到了 gtk `3.24.51` 的 `gtk-query-immodules`。
        版本行:

            # Created by /usr/bin/gtk-query-immodules-3.0 from gtk+-3.24.51

        已找到 gtk `3.24.51` 的 fcitx5 输入法模块。

            "/usr/lib/gtk-3.0/3.0.0/immodules/im-fcitx5.so" 
            "fcitx" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 
            "fcitx5" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 

3.  Gtk 输入法模块缓存:

    1.  gtk 2:

        在 `/usr/lib/gtk-2.0/2.10.0/immodules.cache` 找到了 gtk `2.24.33` 的输入法模块缓存。
        版本行:

            # Created by /usr/bin/gtk-query-immodules-2.0 from gtk+-2.24.33

        **无法输入法模块缓存 `/usr/lib/gtk-2.0/2.10.0/immodules.cache` 中找到 fcitx5**

        **无法在缓存中找到 gtk 2 的 fcitx5 输入法模块。**

    2.  gtk 3:

        在 `/usr/lib/gtk-3.0/3.0.0/immodules.cache` 找到了 gtk `3.24.51` 的输入法模块缓存。
        版本行:

            # Created by /usr/bin/gtk-query-immodules-3.0 from gtk+-3.24.51

        已找到 gtk `3.24.51` 的 fcitx5 输入法模块。

            "/usr/lib/gtk-3.0/3.0.0/immodules/im-fcitx5.so" 
            "fcitx" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 
            "fcitx5" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 

4.  Gtk 输入法模块文件:

    1.  gtk 2:

        找到的全部 Gtk 2 输入法模块文件均存在。

    2.  gtk 3:

        找到的全部 Gtk 3 输入法模块文件均存在。

    3.  gtk 4:

        找到的全部 Gtk 4 输入法模块文件均存在。

# 配置:
## Fcitx 插件:
1.  插件配置文件目录:

    找到了 fcitx5 的插件配置目录:`/usr/share/fcitx5/addon`。

2.  插件列表:

    1.  找到了 28 个已启用的插件:

            Simplified and Traditional Chinese Translation 5.1.11
            Classic User Interface 5.1.19
            Clipboard 5.1.19
            Cloud Pinyin 5.1.11
            DBus 5.1.19
            DBus Frontend 5.1.19
            Emoji 5.1.19
            Fcitx4 Frontend 5.1.19
            Full width character 5.1.11
            IBus Frontend 5.1.19
            Input method selector 5.1.19
            Keyboard 5.1.19
            KDE Input Method Panel 5.1.19
            Status Notifier 5.1.19
            Notification 5.1.19
            Pinyin 5.1.11
            Extra Pinyin functionality 5.1.11
            Punctuation 5.1.11
            Quick Phrase 5.1.19
            Rime 5.1.12
            Spell 5.1.19
            Table 5.1.11
            Unicode 5.1.19
            DBus Virtual Keyboard 5.1.19
            Wayland 5.1.19
            Wayland Input method frontend 5.1.19
            XCB 5.1.19
            X Input Method Frontend 5.1.19

    2.  找到了 0 个被禁用的插件:

3.  插件库: 

    所有插件所需的库都被找到。

4.  用户界面:

    找到了 3 个已启用的用户界面插件:

        Classic User Interface
        KDE Input Method Panel
        DBus Virtual Keyboard

    Kimpanel 进程:

          70322 /usr/bin/plasmashell --no-respawn

## 输入法:
1.  `/home/butter/.config/fcitx5/profile`:

        [Groups/0]
        # Group Name
        Name=默认
        # Layout
        Default Layout=us
        # Default Input Method
        DefaultIM=rime

        [Groups/0/Items/0]
        # Name
        Name=keyboard-us
        # Layout
        Layout=

        [Groups/0/Items/1]
        # Name
        Name=rime
        # Layout
        Layout=

        [GroupOrder]
        0=默认

# 日志:
1.  `date`:

        2026年 03月 20日 星期五 00:06:06 CST

2.  `/home/butter/.config/fcitx5/crash.log`:

    `/home/butter/.config/fcitx5/crash.log` 未找到.

**警告:fcitx5-diagnose 的输出可能包含敏感信息,包括发行版名称,内核版本,正在运行的程序名称等。**

**尽管这些信息对于开发者诊断问题有帮助,请在公开发送到在线网站前检查并且根据需要移除的对应信息。**

你不设置GTK_IM_MODULE=fcitx呢?