fcitx / fcitx5

maybe a new fcitx.
1.6k stars 118 forks source link

Gentoo下Flatpak部分应用无法调出输入法 #1026

Closed akeauoupolee closed 5 months ago

akeauoupolee commented 5 months ago

Describe the bug 当我打开flatpak内 Onlyoffice、KeepassXC、Thmix/OOmox、GNUCash、基于Gnomo的应用、librewolf(firefox)、obsidian.输入法不管怎样都没有反应,但是Telegram可以使用输入法。在系统内的应用都正常,我已经搜索了好几遍issus,也尝试了可能的办法,也曾搜了好多个人博客和维基,都没有解决;(。我怀疑是一些包没有安装,但是app-i18n/fcitx-qt和app-i18n/fcitx-gtk安装了,因为我之前在ArchLinux好像一切都正常。fcitx在Gentoo-zh的存储库也是乱乱的,RIME和输入法配置图形化界面只支持fictx4,我一安装就说包冲突。我实在没办法了,发了这个issun

To Reproduce 打开Onlyoffice、KeepassXC、Thmix/OOmox、GNUCash、基于Gnomo的应用、librewolf(firefox)、obsidian等flatpak应用 尝试激活输入法或者输入

Expected behavior 正常的出现输入框并且正确键入汉字

Desktop (please complete the following information):

  1. lsb_release -a:

    LSB Version:    n/a
    Distributor ID: Gentoo
    Description:    Gentoo Linux
    Release:    2.14
    Codename:   n/a
  2. lsb_release -d:

    Description:    Gentoo Linux
  3. /etc/lsb-release:

    DISTRIB_ID="Gentoo"
  4. /etc/os-release:

    NAME=Gentoo
    ID=gentoo
    PRETTY_NAME="Gentoo Linux"
    ANSI_COLOR="1;32"
    HOME_URL="https://www.gentoo.org/"
    SUPPORT_URL="https://www.gentoo.org/support/"
    BUG_REPORT_URL="https://bugs.gentoo.org/"
    VERSION_ID="2.14"
  5. 桌面环境:

    无法确定桌面环境。Hypeland

  6. XDG 会话类型:

    XDG_SESSION_TYPE='wayland'
  7. Bash 版本:

    BASH_VERSION='5.1.16(1)-release'

环境:

  1. DISPLAY:

    DISPLAY=':0'
    
    WAYLAND_DISPLAY='wayland-1'
  2. 键盘布局:

    1. setxkbmap:

      setxkbmap 未找到.

    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.utf8
      LC_CTYPE="zh_CN.utf8"
      LC_NUMERIC="zh_CN.utf8"
      LC_TIME="zh_CN.utf8"
      LC_COLLATE="zh_CN.utf8"
      LC_MONETARY="zh_CN.utf8"
      LC_MESSAGES="zh_CN.utf8"
      LC_PAPER="zh_CN.utf8"
      LC_NAME="zh_CN.utf8"
      LC_ADDRESS="zh_CN.utf8"
      LC_TELEPHONE="zh_CN.utf8"
      LC_MEASUREMENT="zh_CN.utf8"
      LC_IDENTIFICATION="zh_CN.utf8"
      LC_ALL=
  4. 目录:

    1. 主目录:

      /home/C
    2. ${XDG_CONFIG_HOME}:

      环境变量 XDG_CONFIG_HOME 没有设定。

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

    3. Fcitx5 设置目录:

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

  5. 当前用户:

    脚本作为 C (1000) 运行。

Fcitx 状态:

  1. 可执行文件:

    /usr/bin/fcitx5 找到了 fcitx5。

  2. 版本:

    Fcitx 版本: 5.1.8

  3. 进程:

    找到了 1 个 fcitx5 进程:

    11552 fcitx5
  4. fcitx5-remote:

    fcitx5-remote 工作正常。

  5. DBus 界面:

    使用 dbus-send 来检查 dbus。

    DBus 名称 org.fcitx.Fcitx5 的所有者是 :1.94

    DBus 名称 org.fcitx.Fcitx5 的 PID 所有者是 11552

    来自 dbus 的调试信息:

       Group [wayland:] has 7 InputContext(s)
      IC [5a6ce96a229144b692081f8f9cebe931] program:librewolf frontend:wayland_v2 cap:72 focus:0
      IC [b6a69f41cc9a49f1893105b112378a18] program:org.keepassxc.KeePassXC frontend:wayland_v2 cap:100000072 focus:0
      IC [8ca12988a92340cd84d76e4baa3a6151] program:Alacritty frontend:wayland_v2 cap:100000072 focus:0
      IC [c5b2c97dbe984da08409a3ce808e3155] program:Alacritty frontend:wayland_v2 cap:100000072 focus:0
      IC [3b030d4d4fef4d899f2a50382d4ddb6c] program:Alacritty frontend:wayland_v2 cap:100000072 focus:1
      IC [eb1827d4f9b6424db9bb4285287d42ae] program:Alacritty frontend:wayland_v2 cap:100000072 focus:0
      IC [cb8ec4a7c1e745e982728fd74ce6f1f7] program: frontend:wayland_v2 cap:100000072 focus:0
    Group [x11::0] has 0 InputContext(s)
    Input Context without group

Fcitx 配置界面:

  1. 配置工具封装:

    /usr/bin/fcitx5-configtool 找到了 fcitx5-configtool。

  2. Qt 的配置界面:

    未找到 qt 的配置界面。

  3. KDE 的配置界面:

    kcmshell5 未找到.

    无法找到一个图形界面的配置工具,请安装 kcm-fcitx5fcitx5-config-qt

前端设置:

此脚本检查的环境变量仅能显示当前命令行的环境。仍有可能您的环境并没有应用于整个桌面。您可以通过使用命令对某个无法正常工作的进程使用命令 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 未找到.

  4. Qt 输入法模块文件:

    找到了 fcitx5 的 qt5 输入法模块:/usr/lib64/qt5/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so。 找到了 fcitx5 qt5 模块:/usr/lib64/fcitx5/qt5/libfcitx-quickphrase-editor5.so

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

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

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

      "/usr/lib64/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/lib64/gtk-2.0/2.10.0/immodules.cache 找到了 gtk 2.24.33 的输入法模块缓存。 版本行:

      # Created by /usr/bin/x86_64-pc-linux-gnu-gtk-query-immodules-2.0 from gtk+-2.24.33

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

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

    2. gtk 3:

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

      # Created by /usr/bin/x86_64-pc-linux-gnu-gtk-query-immodules-3.0 from gtk+-3.24.41

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

      "/usr/lib64/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. 找到了 27 个已启用的插件:

      Simplified and Traditional Chinese Translation 5.1.4
      Classic User Interface 5.1.8
      Clipboard 5.1.8
      Cloud Pinyin 5.1.4
      DBus 5.1.8
      DBus Frontend 5.1.8
      Emoji 5.1.8
      Fcitx4 Frontend 5.1.8
      Full width character 5.1.4
      IBus Frontend 5.1.8
      Input method selector 5.1.8
      Keyboard 5.1.8
      KDE Input Method Panel 5.1.8
      Status Notifier 5.1.8
      Notification 5.1.8
      Pinyin 5.1.4
      Extra Pinyin functionality 5.1.4
      Punctuation 5.1.4
      Quick Phrase 5.1.8
      Spell 5.1.8
      Table 5.1.4
      Unicode 5.1.8
      DBus Virtual Keyboard 5.1.8
      Wayland 5.1.8
      Wayland Input method frontend 5.1.8
      XCB 5.1.8
      X Input Method Frontend 5.1.8
    2. 找到了 0 个被禁用的插件:

  3. 插件库:

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

  4. 用户界面:

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

    Classic User Interface
    KDE Input Method Panel
    DBus Virtual Keyboard

输入法:

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

    [Groups/0]
    # Group Name
    Name=默认
    # 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=默认

日志:

  1. date:

    2024年 04月 24日 星期三 17:12:00 CST
  2. /home/C/.config/fcitx5/crash.log:

    =========================
    Fcitx 5.1.8 -- Get Signal No.: 11
    Date: try "date -d @1713945188" if you are using GNU date ***
    ProcessID: 2705
    fcitx5(+0x14d8a)[0x5637ea2f1d8a]
    /lib64/libc.so.6(+0x3a2f0)[0x7ff1f605c2f0]
    /usr/lib64/libdbus-1.so.3(dbus_connection_dispatch+0x2b)[0x7ff1f65aff12]
    /usr/lib64/libFcitx5Utils.so.2(+0x689d6)[0x7ff1f66c49d6]
    /usr/lib64/libFcitx5Utils.so.2(+0x6986e)[0x7ff1f66c586e]
    /usr/lib64/libFcitx5Utils.so.2(+0x78693)[0x7ff1f66d4693]
    /usr/lib64/libFcitx5Utils.so.2(+0x73c9c)[0x7ff1f66cfc9c]
    /usr/lib64/libFcitx5Utils.so.2(+0x6f381)[0x7ff1f66cb381]
    /usr/lib64/libFcitx5Utils.so.2(+0x9e07a)[0x7ff1f66fa07a]
    /usr/lib64/libFcitx5Utils.so.2(+0x9a77b)[0x7ff1f66f677b]
    /usr/lib64/libuv.so.1(+0x21ec9)[0x7ff1f6613ec9]
    /usr/lib64/libuv.so.1(+0x32424)[0x7ff1f6624424]
    /usr/lib64/libuv.so.1(uv_run+0x11e)[0x7ff1f660787b]
    /usr/lib64/libFcitx5Utils.so.2(_ZN5fcitx9EventLoop4execEv+0x51)[0x7ff1f66f64e7]
    /usr/lib64/libFcitx5Core.so.7(_ZN5fcitx8Instance4execEv+0x95)[0x7ff1f686fb6b]
    fcitx5(+0xfc8a)[0x5637ea2ecc8a]
    /lib64/libc.so.6(+0x24350)[0x7ff1f6046350]
    /lib64/libc.so.6(__libc_start_main+0x89)[0x7ff1f6046409]
    fcitx5(+0xf205)[0x5637ea2ec205]

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

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

Additional context Add any other context about the problem here.

akeauoupolee commented 5 months ago

这是我在Hyprland设置的环境变量,可能是这里出错了吗。我有几个没有按照维基的变量填写,用的别人的配置文件里的变量,我还是想保守一些。 env = QT_IM_MODULE, fcitx env = XMODIFIERS, @im=fcitx

env = GTK_IM_MODULE, wayland # Crashes electron apps in xwayland,例如出现漏字的情况(但是我的Electron还是漏字)

env = GTK_IM_MODULE, fcitx # My Gtk apps no longer require this to work with fcitx5 hmm
env = SDL_IM_MODULE, fcitx env = GLFW_IM_MODULE, ibus env = INPUT_METHOD, fcitx 麻烦您了

akeauoupolee commented 5 months ago

你好,偶然见我发现我的问题好像已经解决了,我需要给每个应用都打开Dbus会话总线。

wengxt commented 5 months ago

你好,偶然见我发现我的问题好像已经解决了,我需要给每个应用都打开Dbus会话总线。

这不应该啊,他们都应该使用 org.freedesktop.portal通过xdg dbus proxy穿透沙盒

akeauoupolee commented 5 months ago

是与xdg-desktop-portal有关吗,我装的Hyprland和gtk版本,文件选择器可以正常运行。这个东西需要手动启动吗。我还注意到,我电脑里有xdg-dbus-proxy包。我需要反馈什么信息或者去哪里发起提问嘛。好像我之前用arch时候,大部分应用不用开dbus会话总线也可以正常启动。但在gentoo,频频报错,之后我自己乱试,试出来的。

wengxt commented 5 months ago

你进行了什么操作?

akeauoupolee commented 5 months ago

类似添加环境变量,把想装在flatpak的软件安装进系统,这些软件在系统中能调用输入法,上面我贴了在Hyprland内设置的变量。之后在flatseal中每个按钮的开开关关,最后设置是和flatseal默认的权限设置一样,只是都打开了dbus会话总线。之后就没有更多操作了。

wengxt commented 5 months ago

什么开关,哪个开关

akeauoupolee commented 5 months ago

51ff2f9c-fa28-4e18-9fe5-97988738839a.png

例如QQ,其余应用也一样我只打开了Dbus会话总线这个开关

wengxt commented 5 months ago

你不应当需要 flatpak 程序可以访问完全的 dbus session 服务

flatpak run --command=sh org.gnucash.GnuCash

关掉开关,用上面的命令进入任意的 flatpak app 的 container

运行 dbus-send --session --dest=org.freedesktop.DBus --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames

能看到输出中包含 org.freedesktop.portal.Fcitx 吗? method return time=1714009650.979414 sender=org.freedesktop.DBus -> destination=:1.7742 serial=4294967295 reply_serial=2 array [ string "org.freedesktop.DBus" string ":1.7" string ":1.8" string ":1.23" string ":1.345" string ":1.4265" string ":1.4739" string ":1.4741" string ":1.4743" string ":1.4883" string ":1.7689" string ":1.7690" string ":1.7742" string "org.freedesktop.portal.Desktop" string "org.freedesktop.portal.Documents" string "org.freedesktop.portal.Fcitx" string "org.freedesktop.portal.IBus" string "org.gtk.vfs.Daemon" string "org.gtk.vfs.Metadata" string "org.gtk.vfs.UDisks2VolumeMonitor" string "org.gtk.vfs.mountpoint_228449" string "org.gtk.vfs.mountpoint_228469" string "org.gtk.vfs.mountpoint_dnssd" string "org.gtk.vfs.mountpoint_http" ]

akeauoupolee commented 5 months ago

报错了:[📦 org.gnucash.GnuCash ~]$ dbus-send --session --dest=org.freedesktop.DBus --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames Failed to open connection to "session" message bus: Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead

wengxt commented 5 months ago

你的系统不设置 DBUS_SESSION_BUS_ADDRESS 的吗

akeauoupolee commented 5 months ago

我还不知道这个地方,完全按照维基配置的,没有注意到这里

wengxt commented 5 months ago

你先看看你在 host 上有没有这个环境变量

一种可能,你没有用 systemd,或者没有用 pam_systemd 只要用 systemd 的发行版都不会有这个问题 如果你没有用 systemd 的,那你可能也没有启动 session bus,或者启动了,但是没有设置 DBUS_SESSION_BUS_ADDRESS

你自己看看你属于哪种情况

akeauoupolee commented 5 months ago

确实,我用的openrc,关于dbus这里我也没有配置,我在我的启动脚本上改用dbus-run-session Hyprland,一切都正常了,十分谢谢你的帮助😄😄😄