imekit
A cross-platform Rust library for implementing Input Method Engines (IME) using native protocols.
Overview
imekit provides native protocol implementations for creating input methods:
- Linux/Wayland:
zwp_input_method_v2andzwp_text_input_v3protocols - Linux/X11: XIM (X Input Method) protocol
- Linux/IBus: IBus D-Bus interface (fallback when Wayland protocol unavailable)
- Windows: Text Services Framework (TSF)
- macOS: Input Method Kit (IMK)
This is not a text insertion library. It implements the actual IME protocols that allow you to:
- Register as an input method with the system
- Receive text input context (surrounding text, content type)
- Commit text and preedit strings
- Create popup surfaces for candidate windows
Features
| Feature | Description |
|---|---|
log |
Enable logging via the log crate |
tracing |
Enable logging via the tracing crate |
ibus |
Enable IBus support for Linux (via zbus D-Bus interface) |
Platform Support
| Platform | Protocol | Status |
|---|---|---|
| Linux/Wayland | zwp_input_method_v2 |
✅ Full support |
| Linux/Wayland | zwp_text_input_v3 |
✅ Full support |
| Linux/X11 | XIM | ✅ Full support |
| Linux/IBus | D-Bus | ✅ Full support (with ibus feature) |
| Windows | TSF (Text Services Framework) | ✅ Full support |
| macOS | CGEvent/NSTextInputClient | ✅ Full support |
Wayland Compositor Support
| Compositor | Support |
|---|---|
| sway | ✅ Full support |
| Hyprland | ✅ Full support |
| KDE Plasma | ✅ Good support |
| GNOME/Mutter | ⚠️ Uses IBus (enable ibus feature) |
| wlroots-based | ✅ Generally supported |
Usage
Add to your Cargo.toml:
[]
= "0.1"
# Optional: Enable logging
= { = "0.1", = ["log"] }
# Optional: Enable IBus fallback for GNOME/Mutter
= { = "0.1", = ["ibus"] }
Basic Input Method
use ;
Text Input Client (receiving IME input)
use ;
Using IBus Directly
use IBusInputMethod;
Requirements
Linux/Wayland
- Compositor with
zwp_input_method_v2support libwayland-devfor Wayland client libraries
Linux/X11
- X11 display server with XTest extension
libx11-devandlibxtst-devfor X11 libraries
Linux/IBus (with ibus feature)
- IBus daemon running
- D-Bus session bus available
Windows
- Windows 8+ with TSF support
macOS
- macOS 10.5+ with Accessibility permissions
License
Licensed under either of:
- Apache License, Version 2.0
- MIT license