feat(ibus): add kime-ibus IBus engine frontend (#422, #748)#751
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 782ca1e2fb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // IBus `keycode` is the X11 hardware keycode (evdev + 8), which is what | ||
| // kime's keycode table expects as the hardware code. | ||
| let ret = self | ||
| .engine | ||
| .press_key_code(keycode as u16, mods, numlock, &self.config); |
There was a problem hiding this comment.
Add the missing IBus keycode offset
IBus clients pass evdev keycodes to engines (the GTK path subtracts 8 before ProcessKeyEvent: https://github.com/ibus/ibus/blob/main/client/gtk2/ibusimcontext.c#L3085-L3090), but KeyCode::from_hardware_code uses X11 keycodes (A=38, U=30). Passing keycode straight through makes keys decode eight positions early under the real IBus path, so Hangul composition/hotkeys are wrong; add the +8 offset before press_key_code.
Useful? React with 👍 / 👎.
| "UpdatePreeditText", | ||
| &(v, cursor_pos, visible), |
There was a problem hiding this comment.
Emit the engine preedit signal with its mode
IBus's engine interface defines UpdatePreeditText with a fourth mode argument (vubu, see the engine introspection in https://github.com/ibus/ibus/blob/main/src/ibusengine.c), while the three-argument form is the daemon-to-client input-context signal. Emitting only (v, cursor_pos, visible) from the engine makes ibus-daemon fail to decode/drop preedit updates, so users will not see active composition; include a mode such as IBUS_ENGINE_PREEDIT_CLEAR.
Useful? React with 👍 / 👎.
| <component> | ||
| <name>org.freedesktop.IBus.Kime</name> | ||
| <description>Kime Korean input method</description> | ||
| <exec>/usr/bin/kime-ibus --ibus</exec> |
There was a problem hiding this comment.
Use the configured install prefix in the IBus exec
With a normal Meson source install, kime-ibus is installed under ${MESON_INSTALL_PREFIX}/bin (default /usr/local/bin), but this XML always tells ibus-daemon to launch /usr/bin/kime-ibus. Anyone installing with the default prefix gets a selectable component that cannot be activated because the executable path does not exist; generate/substitute this value or use a command that resolves to the installed binary.
Useful? React with 👍 / 👎.
7a5cea3 to
69462c0
Compare
Add a new IBus engine that forwards key events to the kime input engine, providing the supported input-method path on GNOME Wayland where Mutter lacks zwp_input_method_v2 (#422, #748). Feature parity with xim/wayland: preedit + commit + key/focus/reset. No hanja/candidate UI (engine on develop has no candidate enumeration API). IBus is a D-Bus protocol, implemented directly with zbus (pure Rust), matching kime's hand-rolled-protocol philosophy: - connection: discover the bus via IBUS_ADDRESS (or the per-session socket file), request org.freedesktop.IBus.Kime, serve the factory. - factory: org.freedesktop.IBus.Factory.CreateEngine spawns a per-context Engine object at a unique path. - engine: org.freedesktop.IBus.Engine (ProcessKeyEvent, FocusIn/Out[Id], Enable/Disable/Reset/Destroy, plus no-op stubs); emits CommitText / UpdatePreeditText / HidePreeditText. - ibus_types: IBusText/IBusAttrList marshalling ((sa{sv}sv)/(sa{sv}av)), verified by round-trip tests. Key/modifier/CONSUMED mapping mirrors xim/wayland: IBus keycode is the X11 hardware code passed to InputEngine::press_key_code; modifier bits mapped to ModifierState; ProcessKeyEvent returns true iff InputResult::CONSUMED. Build wiring (meson): new `ibus` feature option, cargo -p kime-ibus, binary install rule, and the IBus component XML to share/ibus/component. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FT8zVKCvTRgZiMLPpNw8Hs
Summary
Add a new
kime-ibusfrontend: an IBus engine that forwards input to the kime engine. This is the path for environments where the Wayland input-method protocols are unavailable — notably GNOME Wayland, whose Mutter compositor does not implementzwp_input_method_v2, sokime-waylandcannot work there.Addresses #422 (IBus server interface) and #748 (Ubuntu 26.04 / GNOME Wayland).
What it does
kime(componentorg.freedesktop.IBus.Kime), launched on demand byibus-daemonviakime-ibus --ibus.InputEngineper input context;ProcessKeyEvent→press_key_code→ emitsCommitText/UpdatePreeditText/HidePreeditText, mirroring the xim/wayland contract exactly (modifier/keycode/CONSUMED mapping, commit-then-preedit ordering,LANGUAGE_CHANGED/NOT_READYhandling).tokio), no glib/libibus C deps.Scope (MVP)
Parity with xim/wayland: preedit + commit + key/focus/reset. No hanja/candidate UI — develop's engine exposes no candidate-enumeration API; an IBus lookup table is a clean follow-up once that API exists.
Build
New meson
ibusfeature (auto). Installs thekime-ibusbinary andres/ibus/component/kime.xmltoshare/ibus/component/.Verification
cargo build -p kime-ibus→ clean, 0 warnings.cargo test -p kime-ibus→ 3/3 (IBusText/IBusAttrList(sa{sv}sv)signature + variant round-trip — the riskiest marshalling).--help/--version).Needs live testing (maintainer)
Headless CI can't exercise a real
ibus-daemon, so the following want a live GNOME-Wayland/IBus session: end-to-end IBusText demarshal + visible preedit/commit; daemon activation via the component XML; real keycode/modifier behavior under the GNOME IBus path; socket-file address fallback.🤖 Generated with Claude Code
https://claude.ai/code/session_01FT8zVKCvTRgZiMLPpNw8Hs