feat(linux): fcitx5 plugin for Wayland input + deb packaging#451
feat(linux): fcitx5 plugin for Wayland input + deb packaging#451aeoform wants to merge 8 commits into
Conversation
- fcitx5 C++ plugin (scripts/linux-fcitx5-plugin/) with DBus interface: CommitText, SetHotkey/SetHotkeyRaw, DictationKeyEvent signal - linux_fcitx.rs: DBus client to call plugin from Rust - coordinator/dictation.rs: Wayland insertion via fcitx5 commit_text, streaming insert enabled on Wayland - insertion.rs: fcitx5 commit_text on Linux with clipboard fallback - unicode_keystroke.rs: Linux path uses fcitx5 commit_text - Capsule window show-once on Linux to avoid stealing focus Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Add #[cfg(target_os = "linux")] to mod linux_fcitx to fix macOS/Windows CI compilation (dbus crate is Linux-only). - Wayland: skip capsule window show/hide entirely in emit_capsule so the target app never loses keyboard focus. Text is committed via fcitx5 plugin commit_string — no window means the compositor forwards the commit to the right app. - X11 keeps existing behavior (show capsule window once per session). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Add "Build fcitx5 plugin" step to release-tauri.yml: compiles the C++ plugin via cmake, copies .so + .conf to src-tauri/linux-fcitx5-plugin/ for the Tauri bundler. - Override tauri build --config to include deb.files / rpm.files that place the plugin at /usr/lib/fcitx5/ so it's auto-detected after install. - Add fcitx5, fcitx5-module-dbus as deb/rpm dependencies. - Local builds unaffected (config is CI-only via --config flag). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
PR Reviewer Guide 🔍(Review updated until commit dce03b6)Here are some key observations to aid the review process:
|
When ensure_modifier_hotkey_monitor finds an existing monitor and updates the rdev/CGEventTap binding, it must also sync the new binding to the fcitx5 plugin on Wayland. Previously the early return skipped this, leaving plugin and coordinator out of sync after a hotkey change. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
已修复 stale sync 问题:
其他两个 review 点:
|
|
Persistent review updated to latest commit 265babd |
|
后续我会考虑加上其他的输入法版本。 |
FCITX_INSTALL_ADDONDIR varies by distro (multiarch Ubuntu → /usr/lib/x86_64-linux-gnu/fcitx5/; Fedora → /usr/lib64/fcitx5/; Arch → /usr/lib/fcitx5/). Extract from cmake cache at build time via GITHUB_ENV instead of hardcoding. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
已修复安装路径问题:cmake 运行时通过 关于 savedIc_ 野指针:
|
|
Persistent review updated to latest commit e7cfc14 |
Prevents savedIc_ from becoming a dangling pointer by connecting to the InputContext::destroyed signal when the IC is saved. On destruction the pointer is cleared automatically, and commitText falls through to foreachFocused for the current focused IC. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Persistent review updated to latest commit 9e81339 |
…syntax ic->connect(ic->destroyed, ...) is invalid — InputContext has no two-arg connect overload. Use ic->destroyed.connect(callback) directly, which calls Signal<void()>::connect. Also simplified ScopedConnection storage from unique_ptr to direct member (ScopedConnection is move-assignable). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Persistent review updated to latest commit 1802ed7 |
fcitx5 插件 Wayland/X11 都可使用,不再为 X11 单独维护 enigo XTest。 Linux 统一走 fcitx5 CommitText 直写,插件不可用时降级到剪贴板拷贝。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Linux 统一走 fcitx5 输入法的决策说明最新提交(dce03b6)移除了 Linux 上的 enigo XTest 路径,X11 也和 Wayland 一样统一走 fcitx5 插件 CommitText 直写。 原因:
降级保障:
AppImage:
|
|
Persistent review updated to latest commit dce03b6 |
User description
Summary
scripts/linux-fcitx5-plugin/): DBus interface with CommitText, SetHotkey/SetHotkeyRaw methods and DictationKeyEvent signal. Replaces enigo/XTest for Wayland/X11 compatibility.emit_capsule在 Wayland 上跳过所有窗口操作(show/hide/reposition),目标 app 始终持有键盘焦点。文字通过 fcitx5 插件commitString直接进入目标 app —— 和输入法的行为一致。commit_text(支持中文),失败降级到剪贴板拷贝。streaming_insert_eligible不再被 Wayland 阻断。fcitx5,fcitx5-module-dbus;安装后插件 .so 在/usr/lib/fcitx5/,重启 fcitx5 即自动加载。mod linux_fcitx加了#[cfg(target_os = "linux")],macOS/Windows CI 不再因为 dbus crate 找不到而编译失败。使用方式
Test plan
cfggate 验证)cargo check+ unit tests: 通过/usr/lib/fcitx5/libopenless.so存在fcitx5 -rd无报错PR Type
Enhancement, Bug fix
Description
Add fcitx5 DBus plugin and client
Route Linux dictation through fcitx5
Preserve Wayland focus by skipping capsule
Bundle plugin in Linux packages
Refresh fallback messages and tests
Diagram Walkthrough
File Walkthrough
2 files
Sync Linux hotkeys and capsule focusReplace Linux enigo typing path4 files
Commit Wayland text through fcitx5Prefer fcitx5 for Linux insertionAdd Linux fcitx5 DBus clientImplement fcitx5 dictation plugin5 files
Gate Linux fcitx module loadingAdd plugin build and install helperPackage fcitx5 plugin in releasesBuild and install fcitx5 addonDefine plugin metadata and dependencies1 files
Add Linux DBus dependency