Skip to main content

Diagnose input method (Fcitx/IBus) framework status for Linux applications

Project description

im-diagnose

Diagnose input method (Fcitx/IBus) framework status for Linux applications.

Inspects running processes via /proc to detect their UI framework (GTK3, GTK4, Qt5, Qt6, Electron), window system (X11, XWayland, Wayland), and whether the correct input method module is actually loaded.

Why?

Chinese/Japanese/Korean input on Linux is fragile. A common problem: you set GTK_IM_MODULE=fcitx, but an application silently loads IBus instead (or loads nothing). This tool tells you exactly what each application is doing at runtime.

Quick Start

# Inspect a specific process
python3 im_diagnose.py --pid $(pgrep -f firefox)

# Click a window to inspect (X11/XWayland)
python3 im_diagnose.py --click

# Scan all GUI processes (requires psutil)
python3 im_diagnose.py --all-gui

# Search by name (requires psutil)
python3 im_diagnose.py --search telegram

Installation

From PyPI (recommended):

# Basic install (--click and --pid work without extra dependencies)
pip install linux-im-diagnose

# With psutil for --search and --all-gui modes
pip install linux-im-diagnose[all]

# Or use pipx for isolated install
pipx install linux-im-diagnose[all]

# Or use uv
uv tool install linux-im-diagnose[all]

Then run: linux-im-diagnose --help

Standalone (single file, no install):

curl -O https://raw.githubusercontent.com/cliecy/linux-im-diagnose/main/im_diagnose.py
chmod +x im_diagnose.py
python3 im_diagnose.py --pid 12345

Usage

usage: im_diagnose.py [--click | --pid PID | --search NAME | --all-gui]
                      [--json] [-v] [--no-color] [--version]

Options:
  --click          Click a window to inspect (X11/XWayland)
  --pid PID        Inspect a specific PID
  --search NAME    Fuzzy search by process name (requires psutil)
  --all-gui        Scan all GUI processes (requires psutil)
  --json           Output as JSON
  -v, --verbose    Show loaded .so paths
  --no-color       Disable colored output

Default behavior: --click if DISPLAY is set, otherwise --all-gui.

Sample Output

IM Framework Diagnostic Report
========================================================================
D-Bus IM Services:  Fcitx5: inactive  |  Fcitx: active  |  IBus: active  (Current: sogoupinyin)

Process                  PID    WinSys  Framework      IM Config  IM Loaded  Health
-------------------------------------------------------------------------------------
cinnamon                 4514   X11     GTK3           fcitx      ibus       [WARN]
nemo-desktop             4601   X11     GTK3           fcitx      fcitx      [OK]
qq                       6368   X11     GTK3/Electron  fcitx      fcitx      [OK]
sogoupinyin-service      12020  X11     Qt5            fcitx      fcitx      [OK]
x-terminal-emulator      13785  X11     GTK4           fcitx      ibus       [WARN]

Warnings:
  cinnamon (4514):
    -> GTK_IM_MODULE=fcitx but ibus module loaded instead.
  x-terminal-emulator (13785):
    -> GTK_IM_MODULE=fcitx but ibus module loaded instead. GTK4 dropped GTK_IM_MODULE support; it uses ibus by default.

What It Detects

Category Details
UI Framework GTK3, GTK4, Qt5, Qt6, Electron, Chromium
Container Flatpak, Snap
Window System X11, XWayland, Wayland Native
IM Environment GTK_IM_MODULE, QT_IM_MODULE, QT_IM_MODULES, XMODIFIERS, etc.
IM Loaded Actual .so modules loaded in process memory (fcitx/ibus)
D-Bus Services Fcitx5, Fcitx, IBus daemon status

Health Status

Status Meaning
[OK] IM configuration matches loaded modules
[WARN] Mismatch or missing module (may be expected for daemons)
[??] No IM configuration detected

Known Cases

  • GTK4 apps showing ibus when fcitx is configured: GTK4 removed GTK_IM_MODULE support. It uses IBus by default via the Wayland IM protocol. This is expected behavior.
  • Electron apps with no IM loaded: Electron may need --enable-wayland-ime or --gtk-version=4 flags.
  • Flatpak/Snap apps with no IM module: The IM module may not be installed inside the sandbox runtime.

Requirements

  • Python 3.8+
  • Linux with /proc filesystem
  • Optional: psutil (for --search and --all-gui modes)
  • Optional: xprop (for --click mode on X11)

D-Bus Tools

The tool tries busctl (systemd) first, then falls back to dbus-send for non-systemd systems. If neither is available, D-Bus service detection is skipped.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linux_im_diagnose-0.1.0.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linux_im_diagnose-0.1.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file linux_im_diagnose-0.1.0.tar.gz.

File metadata

  • Download URL: linux_im_diagnose-0.1.0.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for linux_im_diagnose-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4dfba1e4e5441cf264d502f3d1ebc567e99cc88fbe2ae560e4172a006c0c50f8
MD5 35d8da75a78d67bb27ab7ea1bc6b1175
BLAKE2b-256 7b719637f43cadf243442132b759ca759c0856ef2041abcb89ab8a7abd61f4f9

See more details on using hashes here.

File details

Details for the file linux_im_diagnose-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for linux_im_diagnose-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78d413f0a517bab8780d596cf82e6e716dbc8220d26e50b02045660fda8413b1
MD5 92ebbfd287b584d29d712d153b05ff5c
BLAKE2b-256 fd0c3393aa2238a12a0a003862170ddf790bf6c030af6188bf71e6ed2c6fb15e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page