Fcitx5-diagnose

From Fcitx
Revision as of 16:23, 21 May 2022 by Weng Xuetian (talk | contribs)
Jump to navigation Jump to search
Other languages:
English

fcitx5-diagnose is a script that collects lots of different system/fcitx information for developer debugging. But you may also use it to diagnose some of the common issues yourself.

This page is about how to read the output of fcitx5-diagnose and how to diagnose common issues like "Why Fcitx 5 does not work in XYZ applications".

Sections of fcitx5-diagnose output

System Info

There is not too much interesting in this section, but this section is very important to developers. It contains distribution information, desktop environment information, which can help developer to create an exact setup with virtual machine. There are lots of issue that is specific to certain distributions, or certain version. So developers could know the version of packages on your system and the issue itself might be a known issue.

Environment

Display

Since wayland is becoming more and more popular, knowing whether you are using wayland or X11 is very important. When WAYLAND_DISPLAY is not empty, you're likely to be running fcitx under wayland.

Keyboard layout

If you are using multiple keyboard layout, then you might want to take a look at this to check if fcitx correctly send the requested keyboard layout information to the system.

Locale

This part is mostly related to XIM, which is used by non-Gtk/Qt applications. If your current locale is not in "All locales", you would need to generate glibc locale or change to some locale that you have. For how to do that, check the documentation of your distribution.

Fcitx state

This contains information about version of fcitx and some other Fcitx state. One of the common cause of "cannot use fcitx" is that, fcitx is not running at all. It could be that fcitx is autostarted properly when your desktop does not support XDG-autostart or not using some other mechanisms. You can check Setup Fcitx 5 for more details on this topic, but it could also be that fcitx crashed. As for crashes, we will come back to this topic later.

fcitx5 relies a lot on dbus. Nowadays, dbus is likely to work properly on a systemd based system. In some uncommon cases, dbus-daemon is not started properly on some non-systemd systems. You may want to check with your distribution documentation how to do that.

The debug information from dbus may looks like this:

Group [x11::0] has 25 InputContext(s)
  IC [66a3ec082b3d461da81ff1d7700f5e98] program:plasmashell frontend:dbus cap:6000800072 focus:0
  IC [6fce6402d62f4043b3eabc0744046ad9] program:firefox frontend:dbus cap:6000000052 focus:0
  IC [44356279715c45c8a17e95cb73f90047] program:plasmashell frontend:dbus cap:6000800072 focus:0
Input Context without group

From that you can easily know what applications are connected to fcitx. If it is empty or your application does not show up, then that might be the cause of your problem. Though, the "program" may not show for certain frontends. On wayland, if you are only use native wayland protocol, it is expected to only have a single input context listed under wayland.

Group [wayland:socket:20] has 1 InputContext(s)
  IC [73786be321f44da8a81b685a5568efa2] program: frontend:wayland cap:52 focus:0

Fcitx Configure UI

Usually not interesting, but you can check if there is any actual config tool installed.

Frontends setup

This is an important section for diagnosing "cannot use input method".

XIM

On X11 system, if your application is not Gtk/Qt, if it supports input method, it most likely uses XIM.

Xim is requires XMODIFIERS to be set and it will also check the X property on the root window to see if it matches. If anything pops up there you may want to check that.

Qt

If you are using Qt application, you will most likely need to use Fcitx's input method module. Starting from Qt 5, due to X is transitioned to XCB, there is no more XIM support in Qt 5+.

The script itself will try to list all the Qt plugin with fcitx in the name. The directory being checked is based on some heuristics. While it works on most distributions, might fail to check the correct directory in certain cases.

Followings are an exampleo output about that no Qt im module is found.

    **Cannot find fcitx5 input method module for Qt4.**
    **Cannot find fcitx5 input method module for Qt5.**

If you do not use Qt application, you may ignore this section. (fcitx5-configtool requires Qt anyway)

Gtk

Gtk 2/3 requires a immodules.cache file to be updated. In some older version of fcitx5-gtk, there's a similar giomodule.cache file need to be updated, but it is not required anymore for latest fcitx5-gtk. The script will scan through the cache to check if the entries show up in the cache file, and also check whether the plugin shared libraries present. Basically, make sure fcitx5-gtk is installed then you are good to go.

If you do not use Gtk application, you may ignore this section.

Configuration

In this section, the script will check all the addons and versions. The version field is added in recent fcitx 5 version, so you might not see the version field. It is possible that you accidentally disabled certain addons. You may check the output from here. Also, another common reason of "cannot use input method" is that no input method is added to your configuration. In fcitx 4, newly installed engine will be automatically added to the list, this behavior was changed and does not apply anymore. Also, pinyin/table is now in a separate package fcitx5-chinese-addons instead of integrated in the main package like fcitx 4. While on the first run, fcitx 5 may add input method based on your locale, it is likely that you don't have the corresponding engine package installed in the first place. For those reasons, you may not have the engine you need in the list and you will need to add them yourself.