Skip to content

chore(linux): fcitx5 插件打包注入 + 清理 rdev 残留 + 声明系统依赖#546

Merged
H-Chris233 merged 7 commits into
Open-Less:betafrom
aeoform:chore/linux-fcitx5-plugin-inject-and-cleanup
May 29, 2026
Merged

chore(linux): fcitx5 插件打包注入 + 清理 rdev 残留 + 声明系统依赖#546
H-Chris233 merged 7 commits into
Open-Less:betafrom
aeoform:chore/linux-fcitx5-plugin-inject-and-cleanup

Conversation

@aeoform
Copy link
Copy Markdown
Contributor

@aeoform aeoform commented May 28, 2026

User description

变更

fcitx5 插件:运行时复制 → 打包时注入

  • ensure_plugin_installed 精简为版本检查(比对 bundled 与系统安装的 .so 文件大小),不做任何文件 I/O
  • 新增 scripts/inject-fcitx5-plugin.sh,支持 deb/rpm/AppImage,在打包后将 .so + .conf 注入系统 fcitx5 路径
  • fcitx5 addon config 使用 Library=libopenless(CMake 生成),由 fcitx5 自行搜索库路径

清理 rdev 残留

  • hotkey.rs:移除模块文档和 Linux adapter 中的 rdev 相关注释和日志
  • permissions.rs:移除 rdev 引用
  • unicode_keystroke.rs:移除 feedback_rdev_macos_trap.md 引用

声明 Linux 系统依赖

  • tauri.linux.conf.json 为 deb/rpm 添加 depends(libasound2, libdbus-1-3, libssl3, webkit2gtk, libsoup3)和 recommends: fcitx5
  • 安装包时会自动拉取缺失的运行时依赖

构建辅助

  • package.json 添加 prebuild 脚本,自动复制 fcitx5 插件文件到 src-tauri/ 供 Tauri resources 打包
  • .gitignore 忽略打包用的 .so.conf 副本

🤖 Generated with Claude Code


PR Type

Enhancement, Bug fix


Description

  • Move fcitx5 plugin installation to packaging

  • Simplify Linux plugin checks to path validation

  • Declare Linux runtime dependencies for bundles

  • Remove stale rdev-related comments and references


Diagram Walkthrough

flowchart LR
  A["Packaging script"] -- "injects plugin files" --> B[".deb / .rpm bundles"]
  B -- "installs to system paths" --> C["fcitx5 addon + library"]
  D["Runtime checks"] -- "verify paths only" --> E["Linux startup logs"]
  F["Code comments"] -- "remove rdev references" --> G["Hotkey / permission docs"]
Loading

File Walkthrough

Relevant files
Bug fix
hotkey.rs
Remove Linux rdev hotkey references                                           

openless-all/app/src-tauri/src/hotkey.rs

  • Shortens platform docs by removing rdev caveats.
  • Updates Linux adapter comments to describe fcitx5 only.
  • Tweaks placeholder adapter wiring and startup log wording.
+6/-9     
linux_fcitx.rs
Replace runtime plugin copying with checks                             

openless-all/app/src-tauri/src/linux_fcitx.rs

  • Removes the old HOME-based plugin copy routine.
  • Replaces it with system-path existence checks only.
  • Warns when the addon config or .so is missing.
  • Keeps startup free of file I/O and mutations.
+27/-74 
Documentation
permissions.rs
Clean up rdev permission comments                                               

openless-all/app/src-tauri/src/permissions.rs

  • Removes rdev from Windows permission documentation.
  • Simplifies Linux accessibility notes to avoid adapter-specific
    wording.
+2/-2     
unicode_keystroke.rs
Trim obsolete macOS trap references                                           

openless-all/app/src-tauri/src/unicode_keystroke.rs

  • Removes the feedback_rdev_macos_trap.md mention.
  • Keeps the macOS threading warning focused on TSM/TIS behavior.
+1/-2     
Enhancement
inject-fcitx5-plugin.sh
Add package-time fcitx5 injection script                                 

openless-all/scripts/inject-fcitx5-plugin.sh

  • Adds a shell script to inject plugin files into .deb and .rpm.
  • Places libopenless.so and openless.conf into system fcitx5 paths.
  • Detects Debian multiarch paths and RPM 64-bit library paths.
  • Fails clearly when packaging tools are unavailable.
+69/-0   
Configuration changes
tauri.linux.conf.json
Declare Linux bundle runtime dependencies                               

openless-all/app/src-tauri/tauri.linux.conf.json

  • Adds Debian package dependencies for audio, DBus, SSL, and WebKit.
  • Adds RPM equivalents for the same runtime libraries.
  • Marks fcitx5 as a recommended package for Linux bundles.
+28/-0   

- fcitx5 插件改为打包时注入系统路径(inject-fcitx5-plugin.sh),不再运行时复制
- ensure_plugin_installed 改为纯版本检查,不做文件 I/O
- 清理 hotkey/permissions/unicode_keystroke 中 rdev 相关注释和日志
- tauri.linux.conf.json 声明 deb/rpm 运行时依赖及 fcitx5 推荐
- prebuild 脚本自动复制插件文件供 Tauri resources 打包

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 28, 2026

PR Reviewer Guide 🔍

(Review updated until commit 28ef332)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

AppImage Regression

Removing the runtime copy logic leaves no fallback path for AppImage or other portable builds. The new check only verifies files already exist in system locations, and the injection script explicitly skips AppImage, so those builds will start without the fcitx5 plugin if they are still distributed.

/// 检查 fcitx5 插件是否已安装到系统路径。
///
/// 所有 Linux 格式(deb/rpm/AppImage)的插件安装都在打包时完成
///(`scripts/inject-fcitx5-plugin.sh`),此处仅确认文件存在。
/// 未安装时输出警告,不做任何文件 I/O。
#[cfg(target_os = "linux")]
pub fn ensure_plugin_installed(_app: &tauri::AppHandle) {
    // fcitx5 在不同发行版的 lib 路径不同
    let lib_dirs = [
        "/usr/lib/x86_64-linux-gnu/fcitx5", // Debian multiarch
        "/usr/lib64/fcitx5",                 // RPM 64-bit
        "/usr/lib/fcitx5",                   // 通用回退
    ];
    let system_conf = std::path::Path::new("/usr/share/fcitx5/addon/openless.conf");

    if !system_conf.exists() {
        log::warn!(
            "[fcitx] fcitx5 addon config not installed at {:?}. \
             The OpenLess package may be incomplete.",
            system_conf
        );
        return;
    }

    let found = lib_dirs.iter().any(|dir| {
        std::path::Path::new(dir).join("libopenless.so").exists()
    });

    if !found {
        log::warn!(
            "[fcitx] fcitx5 plugin .so not found in any of {:?}. \
             The OpenLess package may be incomplete.",
            lib_dirs
        );
    }
}

aeoform and others added 2 commits May 28, 2026 23:13
The prebuild script used bash syntax (mkdir, for, [ -f ]) which fails on
Windows. Replace with a Node.js script that checks platform() and skips
non-Linux, keeping the plugin copy logic only where it's needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Remove `resources` from tauri.linux.conf.json — the .so/.conf files
  don't exist on CI (plugin is built separately), causing cargo check
  to fail with "resource path doesn't exist"
- Simplify ensure_plugin_installed to just check system paths exist,
  no bundled comparison needed
- Remove prebuild script and copy-plugin.mjs (no longer needed)
- Remove plugin entries from .gitignore

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit 2bd733e

- RPM: use /usr/lib64/fcitx5/ (RPM 64-bit standard) instead of
  Debian multiarch path
- AppImage: only support AppDir directory input, remove .AppImage file
  extraction which couldn't repack and would lose changes

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit 0e5f90b

Debian uses /usr/lib/x86_64-linux-gnu/fcitx5, RPM uses /usr/lib64/fcitx5,
and some distros use /usr/lib/fcitx5. Check all three to avoid false
alarms on non-Debian systems.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit 71a3634

…ally

- AppImage cannot work for fcitx5 plugin injection: fcitx5 runs on the
  host system and loads addons from host paths (/usr/lib/.../fcitx5).
  Files placed inside the AppImage mount are invisible to fcitx5.
- For Debian, use dpkg-architecture to detect the multiarch triplet
  (x86_64-linux-gnu, aarch64-linux-gnu, etc.) instead of hardcoding.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit f5bf1ff

@aeoform
Copy link
Copy Markdown
Contributor Author

aeoform commented May 28, 2026

AppImage 不支持的原因

AppImage 是自包含便携格式,没有"安装"步骤。fcitx5 作为 host 系统输入法框架,从 AppImage 挂载点内部无法加载插件 .so——文件必须在 host 的真实文件系统路径上。因此 fcitx5
插件注入仅支持实际安装到系统的 deb/rpm。

exit 0 on rpmrebuild failure produced a broken RPM silently.
Use exit 1 and print to stderr so the CI pipeline catches it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit 28ef332

@aeoform
Copy link
Copy Markdown
Contributor Author

aeoform commented May 28, 2026

如果插件出现错误,我觉得很可能是正常方式无法安装,应该让用户手动安装

@aeoform
Copy link
Copy Markdown
Contributor Author

aeoform commented May 28, 2026

appimage老年是便携,但是现在必须安装插件,不符合appimage的初衷,fcitx插件现在有一些问题,我打算等这个pr合并后,明天晚上再改一下,现在如果openless返回错误,那么必须重启输入法才可以消除提示否则一直跟随焦点

@H-Chris233 H-Chris233 merged commit e4acd1d into Open-Less:beta May 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants