$ show mike-fabian/ibus-typing-booster
ibus-typing-booster is a Linux IBus input method engine that provides intelligent text completion, emoji/Unicode symbol input, and multi-language transliteration to speed up typing. It functions as a daemon (ibus-engine-typing-booster) that intercepts keyboard input and provides candidate suggestions based on hunspell dictionaries, user learning history (SQLite), m17n input methods, and optional AI chat models (Ollama). It includes a GTK-based setup tool for configuration and a standalone emoji picker application. The architecture is a monolithic Python application tightly integrated with the IBus framework via D-Bus and PyGObject. It is event-driven (GLib main loop) and supports both GTK3 and GTK4 through a comprehensive compatibility layer. Key data flows involve querying multiple backends (hunspell, m17n, emoji matcher, user database) on each key event and presenting a unified candidate list to the user. The system learns from user selections and stores contextual bigram/trigram data in a local SQLite database. The codebase exhibits high craftsmanship in several self-contained modules. The GTK3/GTK4 compatibility helpers (g_compat_helpers.py) provide a robust abstraction layer for cross-version GUI development. The m17n transliteration module (m17n_translit.py) is a sophisticated ctypes wrapper around a C library. The emoji matching engine (itb_emoji.py) parses multiple Unicode and CLDR data sources to provide comprehensive emoji search. The user learning database (tabsqlitedb.py) implements a well-designed contextual prediction storage system. Maintenance is active with recent commits and responsive issue tracking. Technical drift is medium; while the project actively manages GTK3/4 compatibility, it retains a legacy Autotools build system alongside pyproject.toml, and some CI infrastructure (Ubuntu 18.04) is outdated. The large number of external dependencies (hunspell, m17n-lib, libvoikko, rapidfuzz) and the fragile ctypes bindings to libm17n represent ongoing maintenance risks.
The LLM identified 4 files worth highlighting for reuse:
Provides a comprehensive abstraction layer over GTK3 and GTK4 API differences. Includes add_child, show_all, PopupManager, ClickableEventBoxCompat, MessageDialogCompat, ConfirmDialogCompat, CompatButton, HeaderBarCompat, FakeEventKey, and liststore_append. This is a highly non-trivial, well-structured compatibility shim that solves a real, painful problem for PyGObject developers. It is self-contained and could be extracted into a standalone library for any project needing to support both GTK3 and GTK4.
Wraps the libm17n C library using ctypes to provide transliteration for dozens of languages. It handles complex state management (committed text, preedit, cursor position, candidates), modifier keys, and digit conversion. The TransliterationParts namedtuple is a clean data structure. The DIGIT_TRANS_TABLE is a reusable mapping for normalizing non-ASCII digits. This is a sophisticated FFI wrapper that demonstrates careful handling of C library lifecycle, memory management, and error states. It is largely self-contained and could be extracted as a python-m17n library.
Implements a comprehensive emoji and Unicode symbol matching engine. It parses multiple Unicode data files (UnicodeData.txt, emoji-data.txt, emoji-sequences.txt, emoji-zwj-sequences.txt, emoji-test.txt, emoji.json) and CLDR annotation XML files. It supports multiple matching algorithms (classic, rapidfuzz), skin tones, flags, ZWJ sequences, variation selectors, and version filtering. The EmojiMatcher class with functools.cache is a well-designed, self-contained data processing and querying module. It could be extracted as a python-emoji-data library for any application needing robust emoji search and metadata.
Manages a SQLite database for user phrase learning with bigram/trigram context, frequency tracking, timestamps, and cleanup routines. It supports versioned schema migrations, WAL mode, context managers for transactions, and training from text files. This is a well-crafted, self-contained persistence layer for a predictive text system. It could be extracted and reused in any application requiring a lightweight, context-aware user history database (e.g., virtual keyboards, chatbots, code completion tools).