Linux IBus input method engine for LangAutoSwitcher.
Status: SKELETON. The Rust core is wired up and the demo binary runs. IBus integration is not implemented yet. Contributions welcome.
cargo build -p langauto-linux
cargo run -p langauto-linuxProduces:
=== LangAutoSwitcher (Linux skeleton) ===
napisah → написах [BG, conf=1.00]
now → нов [BG, conf=0.90]
kod → код [BG, conf=1.00]
hello → hello [EN, conf=1.00]
world → world [EN, conf=1.00]
kak → как [BG, conf=1.00]
si → си [BG, conf=1.00]
✓ langauto_core works on Linux.
TODO: wire to IBus.
This proves the cross-platform Rust core compiles and runs correctly on Linux.
The hard work — turning this demo into an actual input method:
Create an IBus component XML file at /usr/share/ibus/component/langauto.xml:
<component>
<name>org.freedesktop.IBus.LangAutoSwitcher</name>
<description>Auto-switching EN/BG input method</description>
<exec>/usr/bin/langauto-linux --ibus</exec>
<version>0.1.0</version>
<engines>
<engine>
<name>langauto</name>
<longname>LangAutoSwitcher</longname>
<language>bg</language>
<symbol>Аб</symbol>
</engine>
</engines>
</component>Use one of these approaches (pick one):
- Direct C bindings:
bindgenagainst/usr/include/ibus-1.0/ibus.h - D-Bus:
zbuscrate to speak the IBus protocol directly - GLib wrapping:
glib+giocrates
The IBus protocol is documented at https://github.com/ibus/ibus/wiki
Implement the process_key_event callback:
fn process_key_event(&mut self, keyval: u32, keycode: u32, modifiers: u32) -> bool {
// Translate keyval to char
// Append to current word buffer
// On space/punctuation/Enter: call detector.process_word()
// then commit_text() the result back to IBus
// Return true if we consumed the event
}Call update_preedit_text() on each keystroke so the user sees the Latin
characters underlined before they commit (matches the macOS UX).
On Ubuntu/Debian:
sudo apt install libibus-1.0-devOn Fedora:
sudo dnf install ibus-develcargo build --release -p langauto-linux
sudo cp target/release/langauto-linux /usr/bin/
sudo cp langauto-linux/langauto.xml /usr/share/ibus/component/
ibus restart
ibus engine langautoThese IBus engines have similar shapes and are good models:
- ibus-typing-booster (Python): https://github.com/mike-fabian/ibus-typing-booster
- ibus-rime (C): https://github.com/rime/ibus-rime
- fcitx5-rime (C++): https://github.com/fcitx/fcitx5-rime
Want to help? Open an issue or PR. The core logic is already done — you only need to write the OS plumbing.