Free & Open Source Multilingual Input Method
Gõ tiếng Việt theo tốc độ tư duy của bạn.
InputKey is a Rust-first multilingual input method with one language-independent root composition machine shared across browser, Windows, Linux, and macOS. Vietnamese is the default language; InputKey also bundles French, Danish, Swedish, and German Telex-style language packs.
- Chrome / Edge — Manifest V3 extension backed by Rust WebAssembly.
- Windows — TSF text service with automatic target-aware text transports and a tray app.
- Linux — Fcitx5 and IBus adapters over the Rust C ABI.
- macOS — native InputMethodKit input method over the Rust C ABI.
InputKey uses one semantic root state machine across every platform. Physical input is classified into Character, SpaceBoundary, PunctuationBoundary, CaretMoveBoundary, ShortcutBoundary, CompositionControl, RawBoundary, or Lifecycle. The root enters that state first, then synchronously emits a RootTransition to the active language machine.
- Character input stays in composition and is interpreted by the selected language FSM.
- Space enters
SpaceBoundary; punctuation such as. , ! ? ; :enters the distinctPunctuationBoundary. They remain separate semantic states, but both ask the language FSM to resolve its word-boundary policy before the root emits the original delimiter. Vietnamese therefore applies the same correction policy todduwocjanddduwocj.. - Mouse clicks, Enter, Tab, arrows, Home/End, Page Up/Down, Delete, and Insert enter one
CaretMoveBoundarystate while retaining the original cause. The language commits the currently displayed composition, then the original caret-moving event continues to the application. - Ctrl/Alt/Win command chords enter
ShortcutBoundary: the displayed composition is committed first, then the original shortcut continues unchanged. AltGraph is treated as character input, not as a shortcut. - Backspace and Escape are
CompositionControlevents. - Shift+Space uses
SpaceBoundaryand inserts a space if the displayed token equals its raw keystrokes; otherwise it entersRawBoundary, commits the physical keystrokes and consumes Space without inserting it. - Focus loss, context destruction, disable, language changes, finalize, and reset are explicit Lifecycle events.
For example, if dd displays đ, Left Arrow commits đ before the caret moves; clicking elsewhere does the same through CaretMoveBoundary(Mouse). Ctrl+A commits the displayed token before Select All runs. refer may display a transformed candidate, while Shift+Space commits the physical refer.
The root owns semantic routing and lifecycle only. Vietnamese, French, Danish, Swedish, German, and future language packs keep their own language-specific FSMs and receive RootTransition events through one transition entrypoint instead of operation-specific methods.
Windows uses the TSF text service as the primary input path. InputKey automatically maintains its current-user Text Service profile and COM binding without elevation, then asks Windows to enable and activate that profile. Activation is best-effort because Windows may decline activation in a process/session even when the user registration and binding exist; in that case InputKey keeps its compatibility input path available. Applications that were already open before registration may need to be restarted once so their TSF thread manager can load InputKey.
The packaged Windows runtime keeps TSF binaries and native language packs under runtime/<version>/. Portable deployment stages and verifies the complete new runtime first, then switches the current-user COM binding to that version. Starting InputKey.exe idempotently repairs the current-user TSF registration/binding and requests activation; it never requires UAC or an administrator token. Already-open applications may keep their previously loaded version until they close, and old runtime folders are never overwritten during that handoff.
Closing the tray app gracefully turns InputKey off before exit but keeps the current-user TSF registration intact. Remove Windows integration... is the explicit cleanup path: it turns InputKey off, removes Start with Windows, unregisters the current user's InputKey Text Service profile/COM binding, and exits without deleting the portable folder. Normal InputKey.exe startup never creates or repairs autorun state. The tray's Start with Windows checkbox is the explicit user action that creates or removes InputKey's current-user HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run value directly; no startup helper process or Startup-folder shortcut is used. The default on/off shortcut is Ctrl+Shift; for this modifier-only shortcut both keys must come from the same side (Left Ctrl + Left Shift or Right Ctrl + Right Shift), so cross-hand modifier chords do not toggle InputKey accidentally. It can be changed in Settings to combinations such as Alt+Z or Ctrl+Shift+K, or set to Off. Ctrl+Alt combinations are rejected so AltGr remains character input.
When TSF is unavailable for the focused target, the lifecycle-bound InputKeyCompatibility.exe helper probes target capabilities instead of routing by application name. The tray/control InputKey.exe does not host the global keyboard or mouse hooks itself. Compatibility prefers owned native edit ranges, then UI Automation editable patterns, and uses an isolated synthetic transport only for compatible fallback surfaces such as Remote Desktop or custom Chromium render surfaces. Clipboard-backed paste remains a guarded secondary transport for supported native edits. Password and read-only fields are excluded, injected InputKey events are ignored by the hook, and clipboard restoration never overwrites a newer clipboard change made by another application.
The shared engine supports:
- Telex and Simple Telex
- VNI
- tone placement and Vietnamese vowel shapes
dd → đw-based Vietnamese shape input- repeat-to-cancel
- English collision recovery
- Backspace/Escape reconstruction
- semantic caret/shortcut/composition/lifecycle boundaries and conditional one-shot Shift+Space raw escape
- language-owned boundary correction triggered by both Space and punctuation boundaries
At Space or punctuation boundaries, the Vietnamese FSM can recover modifier-order variants without inventing missing tone input, including nhieue → nhiều, chueyern → chuyển, dduocwj → được, and dduwocj → được. Boundary correction preserves the physical initial prefix: consonant onsets stay intact (stop → stop), while vowel-initial candidates remain in the same family (a/ă/â, e/ê, o/ô/ơ, u/ư, i, y). [ and ] are ordinary punctuation, not Vietnamese shape shortcuts. Live typing remains sequential; explicit repeat-cancel still happens immediately at the character event.
InputKey performs typing conversion locally. The browser extension loads its packaged inputkey.wasm resource locally and does not need a remote typing service. Native adapters use the local Rust engine directly.
Rust stable is required for Rust targets.
cargo fmt --all -- --check
cargo test --workspace
cargo clippy --workspace --all-targets -- -D warnings
python Bootstrap/Build/check-architecture.pyChrome / Edge on Windows:
.\Bootstrap\Build\build-chrome.ps1Chrome / Edge on Unix-like hosts:
./Bootstrap/Build/build-chrome.shWindows:
.\Bootstrap\Build\build-windows.ps1
.\Bootstrap\Build\test-windows-lifecycle.ps1macOS:
./Bootstrap/Build/build-macos.sh
./Bootstrap/Build/install-macos.shLinux Fcitx5 and IBus adapters are built with CMake after building inputkey-cabi.
GitHub Actions validates Linux, Windows, macOS, and Chromium builds. Version tags (v*) publish GitHub Release artifacts automatically.
Boundary/— engine input/output contractsCoreAbstractions/— shared interfaces and state typesOperators/— language-independent root composition machineImplementations/Languages/— language-specific child machinesImplementations/LanguagePackLoader/— native dynamic language-pack discoveryImplementations/— browser/OS integrationsBootstrap/— entry points and build tooling
See ARCHITECTURE.md for a short component overview.
InputKey is licensed under GPL-2.0-or-later. See LICENSE and THIRD_PARTY_NOTICES.md.