• v0.1.8 fdd253a60d

    v0.1.8
    Some checks failed
    Build & Release / Build & test (push) Has been cancelled
    Release / build (push) Has been cancelled
    Build & Release / Build .deb (push) Has been cancelled
    Stable

    vndangkhoa released this 2026-07-13 21:22:19 +07:00 | 9 commits to main since this release

    v0.1.8

    Rootless Operation

    • Runs with zero privileges: vietc now operates as a normal user — no root, no setcap, no /dev/uinput/udev, no input group. It speaks zwp_input_method_v2 when the compositor offers it, and otherwise falls back to the rootless X11 path (XQueryKeymap + XTEST over XWayland), like ibus-x11.
    • Automatic IBus takeover: on start vietc stops IBus; on a clean exit it restarts IBus automatically (via IbusRestartGuard), so it transparently replaces the system IME and restores it when you quit.
    • systemd user service: vietc.service starts vietc on login (After=graphical-session.target, ConditionEnvironment=DISPLAY, KillMode=process so the respawned IBus survives the stop). Enable once with systemctl --user enable --now vietc.service.
    • Packaging aligned: install.sh and the deb now install the rootless vietc.service (running vietc-daemon directly) instead of the tray autostart, and ship grab = false by default. The privileged evdev/uinput path remains available as a fallback.
    • Known limitation: current Mutter/GNOME Shell does not expose zwp_input_method_manager_v2, so on that session the X11 path covers X11/XWayland windows only; Wayland-native GTK4/Qt clients are covered automatically once the compositor advertises v2. See docs/wayland-rootless.md.

    Aux Controller — Wayland Terminal / Per-App Handling

    • Bamboo aux controller mode: vietc now runs as an aux controller (controller_mode = true) that drives the system Bamboo IBus engine per focused app instead of registering its own engine. Vietnamese composition is done by Bamboo; vietc only switches BambooBambooUs and handles password fields.
    • Undetectable (Wayland-native) windows left alone: on this GNOME/Wayland session no API reports the focused Wayland-native window (GNOME Shell Eval is gated off, xprop only sees XWayland, AT-SPI2 carries no focus flag/event). When get_focused_window_class() returns None, the controller now issues no engine switch (previously it force-Vietnamese, which garbled Wayland terminals like ptyxis).
    • Per-app engine memory required: relies on IBus per-application engine memory — set dconf write /desktop/ibus/general/use-global-engine false so each app keeps its own IBus engine (ptyxis → BambooUs/English, firefox/gedit → Bamboo/Vietnamese). One-time manual setup per app; vietc only drives the apps it can see (VS Code, X11 terminals).
    • VNI allow-list: default vietnamese_apps now includes gedit, gnome-text-editor, org.gnome.TextEditor.
    • Universal typing-style switch (vietcctl): new vietcctl tool cycles the typing style EN → VNI → TELEX → EN (and supports en/vni/telex/status). It persists the choice to ~/.config/vietc/mode, rewrites Bamboo's InputMethod, and switches the active IBus engine. Install.sh registers Left Ctrl+Space as a GNOME custom keybinding (<Primary>spacevietcctl cycle) so the shortcut works on Wayland too — independent of whether vietc holds the keyboard grab.

    Modular Refactoring

    • Monolithic 2151-line main.rs split into 11 focused modules: Each module has a single responsibility — event.rs (pure event routing, testable without I/O), evdev_loop.rs (poll loop only), inject.rs (command execution), daemon.rs (Daemon struct + process_key/toggle/replay), device.rs (keyboard discovery + permissions), signal.rs (signal handling + single-instance lock), stdin.rs (stdin mode with retry), x11_capture.rs (X11 RECORD + keymap capture), env.rs (DISPLAY/DBUS recovery), commands.rs (OutputCommand enum), log.rs (log rotation).
    • Pure functions extracted to event.rs: Grab-mode keystroke rendering can now be tested without evdev or uinput devices — verifies engine composition + daemon forwarding decisions in pure Rust.
    • 104 unit tests (20 daemon + 72 engine + 12 protocol), all passing.

    Bug Fixes

    • Grab now persists for daemon lifetime: Removed idle-grab fallback (300ms). Previously the daemon released the grab after 3 idle polls (~300ms), forcing a non-grabbed fallback that had inherent race conditions. Now the grab is held until the daemon exits.
    • Double-input from non-primary devices fixed: Changed if !grabbed && i != 0 to if i != 0 — devices that are not the primary keyboard (index 0) are always skipped in the engine path. Their events reach the application directly; processing them through the engine injected a second copy of every keystroke.
    • Engine-disabled key forwarding in grabbed mode: When the engine is toggled OFF, keys are forwarded directly via injector.send_key_event() instead of being consumed and paste-injected.

    Integration Testing

    • Virtual keyboard test harness (daemon/tests/common/virtual_keyboard.rs): Creates /dev/uinput virtual devices for sending synthetic keystrokes in CI.
    • Clipboard backend (daemon/tests/common/clipboard.rs): Reads system clipboard via xclip (X11) or wl-paste (Wayland) to verify daemon output.
    • Distro detection (daemon/tests/common/distro.rs): Auto-detects Ubuntu, Mint, Fedora, Arch, display server, and desktop environment for backend selection.
    • DaemonProcess subprocess manager (daemon/tests/common/mod.rs): Spawns, monitors logs, and kills the daemon subprocess for integration tests.
    • Daemon integration suite (daemon/tests/daemon_suite.rs): Tests for virtual keyboard creation, clipboard read/write, and VNI word injection in both grabbed and non-grabbed modes.

    Documentation

    • Testing dictionary (docs/testing-dictionary.md): Comprehensive glossary covering 40+ test scenarios with TEST-NNN, SETUP, INPUT, EXPECTED, and CHECKS for all 4 suites (engine, event, daemon, regression).

    Distro Support

    • Distro support table: README now lists supported (Ubuntu, Debian, Mint, Pop!_OS, elementary, Zorin, Neon, Fedora, RHEL, CentOS, Arch, Manjaro), might-support (openSUSE, Solus, Void), and not-supported (NixOS, Alpine, Gentoo) distros.
    • libwayland-dev added to install.sh for all distro families (was missing — caused build failures on X11-only systems like Linux Mint).
    • libwayland-client0 added to runtime deps (was missing — caused "cannot open shared object file" on Mint).
    • Config typo fixed: mặt khẩumật khẩu in default config and README.

    Documentation

    • Roadmap section added to README (v0.1.22: Wayland IM protocol, event-based AT-SPI2; v0.1.23: CI, Flatpak).
    • RELEASE_CHECKLIST.md removed (process now documented in the release commit messages).

    Downloads