ImeStatus

Linux parity: P2 adapted

Returns live information about the Linux input-method framework and committed-text listener.

Status := ImeStatus()

Return Value

Returns an object with the following own properties:

Framework
"ibus", "fcitx5" or "none".
Engine
The active engine name when available, such as "libpinyin".
Preedit
1 while composition/preedit is active, otherwise 0.
Listening
1 when the private commit/preedit signal listener is connected.
Scope
"eavesdrop" when cross-context signals are observable, "state-only" when only framework state is available, or "none".
XkbGroup
Current X11 XKB group, or -1 without an X display.
Commits / PreeditEvents
Signal counters observed by this process.
LastCommit
The most recent committed UTF-8 text.

IME character-stream semantics

Physical keyboard events continue to drive InputHook key options and EndKeys. With a composing engine, physical OnChar candidates are held for at most 500 ms to resolve the cross-bus preedit race. During preedit, the trailing phonetic token and queued candidates are removed from the Hotstring/InputHook character stream and collection is frozen. A 200 ms tail window absorbs commit/cancel keys when the IME and physical streams arrive in opposite order. Canceling composition leaves the buffer unchanged. Only the framework's committed text is appended, sent to InputHook OnChar, and reported as normalized IME_COMMIT events.

Privacy: The cross-context listener starts only when Hotstrings/InputHook require it or a script explicitly calls ImeStatus. Once started it remains active for the script lifetime and can observe focused committed text system-wide, like the global keyboard capture path.
Coverage: IBus/libpinyin is verified end-to-end on GNOME with a real GTK input context and FocusIn-scoped filtering. Fcitx5 InputContext1 is protocol-tested in CI, but a real Fcitx5 desktop and Flatpak/portal IM visibility are not available in the current matrix. The runtime observes the user's IME; it does not replace or toggle it.

Example

s := ImeStatus()
ToolTip s.Framework " / " s.Engine " / preedit=" s.Preedit
; Result: ibus / libpinyin / preedit=0