Skip to content

kde(wayland)+firefox:切换虚拟桌面后输入法失效 #1323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dragove opened this issue Apr 17, 2025 · 6 comments
Open

kde(wayland)+firefox:切换虚拟桌面后输入法失效 #1323

dragove opened this issue Apr 17, 2025 · 6 comments

Comments

@dragove
Copy link

dragove commented Apr 17, 2025

Summary

在firefox的输入框中使用中文输入法,切换到其他虚拟桌面再回来后输入法无法使用。用alt+tab切换后恢复。切换到英文再切换回来首次输入内容也会丢失。

此行为只发生在firefox不在首个虚拟桌面上且kde开启切换动画时

Screencast_20250417_124759.webm

Steps to Reproduce

  1. 打开firefox,进入空白页输入框,切换到汉字输入法
  2. 切换虚拟桌面到其他虚拟桌面再切换回来
  3. 此时光标仍然在浏览器输入框中,直接输入拼音,选字框丢失,而且拼音顺序也发生错误。

Expected Behavior

输入法正常使用

Output of fcitx5-diagnose command

System Info:

  1. uname -a:

    Linux arch 6.14.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 10 Apr 2025 18:43:59 +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. Desktop Environment:

    Desktop environment is kde.

  7. XDG SESSION TYPE:

    XDG_SESSION_TYPE='wayland'
    
  8. Bash Version:

    BASH_VERSION='5.2.37(1)-release'
    

Environment:

  1. DISPLAY:

    DISPLAY=':1'
    
    
    WAYLAND_DISPLAY='wayland-0'
    
  2. Keyboard Layout:

    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)+capslock(escape)"	};
      	xkb_geometry  { include "pc(pc105)"	};
      };
      
    2. xprop:

      _XKB_RULES_NAMES(STRING) = "evdev", "pc105", "us", "", "caps:escape"
      
  3. Locale:

    1. All locales:

      C
      C.utf8
      en_US.utf8
      POSIX
      zh_CN.utf8
      zh_SG.utf8
      
    2. Current locale:

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

    1. Home:

      /home/dove
      
    2. ${XDG_CONFIG_HOME}:

      Environment variable XDG_CONFIG_HOME is not set.

      Current value of XDG_CONFIG_HOME is ~/.config (/home/dove/.config).

    3. Fcitx5 Settings Directory:

      Current fcitx5 settings directory is ~/.config/fcitx5 (/home/dove/.config/fcitx5).

  5. Current user:

    The script is run as dove (1000).

Fcitx State:

  1. executable:

    Found fcitx5 at /usr/bin/fcitx5.

  2. version:

    Fcitx version: 5.1.12

  3. process:

    Found 3 fcitx5 processes:

       1141 fcitx5-wayland-
       1142 fcitx5
       1232 fcitx5-plasma-t
    
  4. fcitx5-remote:

    fcitx5-remote works properly.

  5. DBus interface:

    Using dbus-send to check dbus.

    Owner of DBus name org.fcitx.Fcitx5 is :1.27.

    PID of DBus name org.fcitx.Fcitx5 owner is 1142.

    Debug information from dbus:

       Group [x11::1] has 26 InputContext(s)
      IC [7564b98da46d40dd919ca5ebc956a80e] program: frontend:xim cap:4000000000 focus:0
      IC [3c8540b4460a426eaa4afb0bbd6a29aa] program: frontend:xim cap:4000000000 focus:0
      IC [25b58cee678f4e5ea6da6dfca694b358] program:idea frontend:xim cap:4000000000 focus:1
      IC [d3290525005342f4b04d5c2a976f9428] program:com.alibabainc.dingtalk frontend:dbus cap:16000800072 focus:0
      IC [585ecad5c7d248ef96adc8925b387479] program:com.alibabainc.dingtalk frontend:dbus cap:16000800072 focus:0
      IC [dbb7da9e91e645a08da048f71632f324] program:idea frontend:xim cap:4000000000 focus:0
      IC [fb112f5a0d2a413a984f037d11a39dc9] program:com.alibabainc.dingtalk frontend:dbus cap:16000800072 focus:0
      IC [781b41fa528d4e7dbcfc269e0a551b6e] program: frontend:xim cap:4000000000 focus:0
      IC [9df889f5644d453882e33d4354541b43] program:datagrip frontend:xim cap:4000000000 focus:0
      IC [561f6c7b7e3c4bf18d5be49b9473678e] program: frontend:xim cap:4000000000 focus:0
      IC [386a53eb7d82456a98ecc684ae111a34] program:com.alibabainc.dingtalk frontend:dbus cap:16000800072 focus:0
      IC [7aaaa4fdd5e040b0bdc8546e7b4653d6] program:com.alibabainc.dingtalk frontend:dbus cap:16000800072 focus:0
      IC [07e449e9613242099692227f45c69612] program:Nutstore frontend:dbus cap:6000000032 focus:0
      IC [45babf5d99c14b1cbed8f7ed0190f0ab] program:Nutstore frontend:dbus cap:6000000032 focus:0
      IC [cc5c2bec873d4a00bbd0ce054e863dcd] program:wechat frontend:fcitx4 cap:800072 focus:0
      IC [5c8b5b0225d24cdf9785345f192b9291] program:idea frontend:xim cap:4000000000 focus:0
      IC [7c6be55367084601a5f14cd7dcd2f04d] program:com.alibabainc.dingtalk frontend:dbus cap:16000800072 focus:0
      IC [1fff690e520d4afa9ae18ad83b6fa692] program:com.alibabainc.dingtalk frontend:dbus cap:16000800072 focus:0
      IC [b32ecaa0f94b436abe37231f767bc8f7] program:com.alibabainc.dingtalk frontend:dbus cap:6800800072 focus:0
      IC [f3dd59ee8eae48de870794ff9a140204] program:com.alibabainc.dingtalk frontend:dbus cap:16000800072 focus:0
      IC [59d63f5e94e34d398663b2306f9b8853] program:com.alibabainc.dingtalk frontend:dbus cap:6000000032 focus:0
      IC [a0dcf74ced7f4fe3a80004858d7a0bde] program:com.alibabainc.dingtalk frontend:dbus cap:16000800072 focus:0
      IC [4099e2303fda4f3bbe021c94d4fae243] program:com.alibabainc.dingtalk frontend:dbus cap:6000000032 focus:0
      IC [b8b1fa806a3e45488b837c0c3218d621] program:com.alibabainc.dingtalk frontend:dbus cap:16000800072 focus:0
      IC [f48f8bcf19d2435386c64260142024c1] program:com.alibabainc.dingtalk frontend:dbus cap:6000000032 focus:0
      IC [11d9862f2f48409c825f312909dc1f73] program:com.alibabainc.dingtalk frontend:dbus cap:16000800072 focus:0
    Group [wayland:] has 8 InputContext(s)
      IC [7ee12e45503349669ba8203cd40be27e] program:firefox frontend:wayland cap:72 focus:0
      IC [74c90a86eba84da0888d59b5fee62fcd] program:jetbrains-idea-8d619cc6-0b25-4305-8902-98dc3442e490 frontend:wayland cap:72 focus:0
      IC [018df53c1b0f4f2f9e1743e1f18dc977] program:jetbrains-datagrip-4dba5307-c28b-43d5-b51a-104ca265941c frontend:wayland cap:80072 focus:0
      IC [9ce8b3f99b23433498ea45cae6ad9815] program:jetbrains-idea-8d619cc6-0b25-4305-8902-98dc3442e490 frontend:wayland cap:72 focus:0
      IC [aef53905b6ca46b89b7e2cbbc591f37b] program:jetbrains-idea-8d619cc6-0b25-4305-8902-98dc3442e490 frontend:wayland cap:72 focus:0
      IC [ae7770e24e184b3ca8187e9ca6de4eb3] program:zen frontend:wayland cap:72 focus:0
      IC [b997d9bf790c439db68f61a81de2517d] program:kitty frontend:wayland cap:100000072 focus:0
      IC [28601a26056042d2b0b059b67eb82961] program: frontend:wayland cap:100000072 focus:0
    Input Context without group
    

Frontends setup:

The environment variable checked by this script only shows the environment under current shell. It is still possible that you did not set the environment to the whole graphic desktop session. You may inspect the actual environment variable of a certain process by using xargs -0 -L1 /proc/$PID/environ for a certain process that you find not working.

Xim:

  1. ${XMODIFIERS}:

    Environment variable XMODIFIERS is set to "@im=fcitx" correctly.
    Xim Server Name from Environment variable is fcitx.

  2. XIM_SERVERS on root window:

    Xim server name is the same with that set in the environment variable.

  3. XIM for Emacs:

    Your LC_CTYPE is set to en_US.UTF-8 instead of one of zh, ja, ko. You may not be able to use input method in emacs because of an really old emacs bug that upstream refuse to fix for years.

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.

    fcitx5-qt4-immodule-probing not found.

  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.

    It is OK to use qt5 built-in Wayland im module if your compositor fully supports text-input protocol used by qt5.

    Using fcitx5-qt5-immodule-probing to check the actual im module to be used under current environment:

    QT_QPA_PLATFORM=wayland
    QT_IM_MODULE=
    IM_MODULE_CLASSNAME=QtWaylandClient::QWaylandInputContext
    
  3. qt6 - ${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.

    It is OK to use qt6 built-in Wayland im module if your compositor fully supports text-input protocol used by qt6.

    Using fcitx5-qt6-immodule-probing to check the actual im module to be used under current environment:

    QT_QPA_PLATFORM=wayland
    QT_IM_MODULE=
    IM_MODULE_CLASSNAME=QtWaylandClient::QWaylandInputContext
    
  4. Qt IM module files:

    Found fcitx5 im module for qt6: /usr/lib/qt6/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so.
    Found unknown fcitx qt module: /usr/lib/qt6/plugins/plasma/kcms/systemsettings/kcm_fcitx5.so.
    Found fcitx5 im module for qt: /usr/lib/qt/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so.
    Found fcitx5 qt5 module: /usr/lib/fcitx5/qt5/libfcitx-quickphrase-editor5.so.
    Found fcitx5 qt6 module: /usr/lib/fcitx5/qt6/libfcitx-quickphrase-editor5.so.

    Following error may not be accurate because guessing Qt version from path depends on how your distribution packages Qt. It is not a critical error if you do not use any Qt application with certain version of Qt or you are using text-input support by Qt under Wayland.
    Cannot find fcitx5 input method module for Qt4.

Gtk:

  1. gtk - ${GTK_IM_MODULE}:

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

    It is OK to use gtk built-in Wayland im module if your compositor fully supports text-input protocol used by gtk.

    Using fcitx5-gtk2-immodule-probing to check the actual im module to be used under current environment:

    GTK_IM_MODULE=fcitx5
    

    Using fcitx5-gtk3-immodule-probing to check the actual im module to be used under current environment:

    GTK_IM_MODULE=wayland
    

    Using fcitx5-gtk4-immodule-probing to check the actual im module to be used under current environment:

    GTK_IM_MODULE=wayland
    
  2. gtk-query-immodules:

    1. gtk 2:

      Found gtk-query-immodules for gtk 2.24.33 at /usr/bin/gtk-query-immodules-2.0.
      Version Line:

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

      Found fcitx5 im modules for gtk 2.24.33.

      "/usr/lib/gtk-2.0/2.10.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:*" 
      
    2. gtk 3:

      Found gtk-query-immodules for gtk 3.24.49 at /usr/bin/gtk-query-immodules-3.0.
      Version Line:

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

      Found fcitx5 im modules for gtk 3.24.49.

      "/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:*" 
      

      Found gtk-query-immodules for gtk 3.24.49 at /usr/bin/gtk-query-immodules-3.0-32.
      Version Line:

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

      Failed to find fcitx5 in the output of /usr/bin/gtk-query-immodules-3.0-32

  3. Gtk IM module cache:

    1. gtk 2:

      Found immodules cache for gtk 2.24.33 at /usr/lib/gtk-2.0/2.10.0/immodules.cache.
      Version Line:

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

      Found fcitx5 im modules for gtk 2.24.33.

      "/usr/lib/gtk-2.0/2.10.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:*" 
      
    2. gtk 3:

      Found immodules cache for gtk 3.24.49 at /usr/lib/gtk-3.0/3.0.0/immodules.cache.
      Version Line:

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

      Found fcitx5 im modules for gtk 3.24.49.

      "/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:*" 
      

      Found immodules cache for gtk 3.24.49 at /usr/lib32/gtk-3.0/3.0.0/immodules.cache.
      Version Line:

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

      Failed to find fcitx5 in immodule cache at /usr/lib32/gtk-3.0/3.0.0/immodules.cache

  4. Gtk IM module files:

    1. gtk 2:

      All found Gtk 2 immodule files exist.

    2. gtk 3:

      All found Gtk 3 immodule files exist.

    3. gtk 4:

      All found Gtk 4 immodule files exist.

Configuration:

Fcitx Addons:

  1. Addon Config Dir:

    Found fcitx5 addon config directory: /usr/share/fcitx5/addon.

  2. Addon List:

    1. Found 27 enabled addons:

      Simplified and Traditional Chinese Translation 5.1.8
      Classic User Interface 5.1.12
      Clipboard 5.1.12
      Cloud Pinyin 5.1.8
      DBus 5.1.12
      DBus Frontend 5.1.12
      Emoji 5.1.12
      Fcitx4 Frontend 5.1.12
      Full width character 5.1.8
      IBus Frontend 5.1.12
      Input method selector 5.1.12
      Keyboard 5.1.12
      KDE Input Method Panel 5.1.12
      Status Notifier 5.1.12
      Notification 5.1.12
      Pinyin 5.1.8
      Extra Pinyin functionality 5.1.8
      Punctuation 5.1.8
      Quick Phrase 5.1.12
      Spell 5.1.12
      Table 5.1.8
      Unicode 5.1.12
      DBus Virtual Keyboard 5.1.12
      Wayland 5.1.12
      Wayland Input method frontend 5.1.12
      XCB 5.1.12
      X Input Method Frontend 5.1.12
      
    2. Found 0 disabled addons:

  3. Addon Libraries:

    All libraries for all addons are found.

  4. User Interface:

    Found 3 enabled user interface addons:

    Classic User Interface
    KDE Input Method Panel
    DBus Virtual Keyboard
    

Input Methods:

  1. /home/dove/.config/fcitx5/profile:

    [Groups/0]
    # Group Name
    Name=Default
    # Layout
    Default Layout=us
    # Default Input Method
    DefaultIM=pinyin
    
    [Groups/0/Items/0]
    # Name
    Name=keyboard-us
    # Layout
    Layout=
    
    [Groups/0/Items/1]
    # Name
    Name=pinyin
    # Layout
    Layout=
    
    [GroupOrder]
    0=Default
    

Log:

  1. date:

    Thu Apr 17 12:56:36 PM CST 2025
    
  2. /home/dove/.config/fcitx5/crash.log:

    /home/dove/.config/fcitx5/crash.log not found.

Warning: the output of fcitx5-diagnose contains sensitive information, including the distribution name, kernel version, name of currently running programs, etc.

Though such information can be helpful to developers for diagnostic purpose, please double check and remove as necessary before posting it online publicly.

@wengxt
Copy link
Member

wengxt commented Apr 17, 2025

测试半天没法重现,你用什么操作切换的桌面?我尝试了鼠标点击,滚轮,以及 Ctrl + F1 F2 都没能触发

你的 firefox 已经在使用 wayland 输入法协议了,因此是否激活并不受 fcitx 的控制。多半是 kwin 的问题

请用 WAYLAND_DEBUG=1 启动 fcitx 并提供切换时的日志

@dragove
Copy link
Author

dragove commented Apr 17, 2025

我配置的快捷键是 win + 数字键切换。用鼠标滚轮也能复现,需要开启虚拟桌面切换动画才能复现,应该是kwin的问题。
WAYLAND_DEBUG=1 启动这一步不太清楚要如何操作,可以直接写到 /etc/environment 里吗,fcitx5是kde配置虚拟键盘启动的。单独启动后在火狐上用不了输入法。
如果是写到环境变量中,请问要如何获取到这部分的日志。

@dragove
Copy link
Author

dragove commented Apr 17, 2025

一点新发现,关闭 show preedit 可以缓解问题,输入时候选框突然跳动到显示器左上角,但是可以继续输入检字。但是当这一次输入完毕后,仍然会变为纯英文输入,需要再次切换才能恢复正常。

@wengxt
Copy link
Member

wengxt commented Apr 18, 2025

你运行这条命令
然后观察输出当中 focus:1 的变化,然后与你的操作对应,注意 -n 2 是每两秒执行一次,所以在命令输出刷新前不要着急判断当前的状态

 watch -n 2 dbus-send --print-reply=literal --dest=org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.DebugInfo

当你描述失效,是仿佛按键完全没有发送到输入法变成了直接输入英文,还是只是单纯出于某种原因进行了切换变成了英文,是否还可以手工切换回来?

@dragove
Copy link
Author

dragove commented Apr 19, 2025

我试了一下,发现触发问题还有另一个条件,切换过去的虚拟桌面里需要有一个应用程序,这样切换后focus会发生变化。
切换回firefox所在的桌面时 firefox 的 focus 变为1,输入法输入内容后变为0,此后输入不会发送到输入法,而是直接输入英文,输入法仍然是停留在中文输入上的。
更新显示focus的视频

fcitx.wrong.2.mp4

@dragove
Copy link
Author

dragove commented May 4, 2025

好像还和kitty有关,我用konsole就没有这个问题

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

No branches or pull requests

2 participants