Skip to content

feat(linux): 选区读取集成进 fcitx5 插件(clipboard addon),删除外部工具依赖 - #961

Merged
H-Chris233 merged 4 commits into
Open-Less:betafrom
aeoform:feat/linux-selection-fcitx-clipboard
Aug 19, 2026
Merged

feat(linux): 选区读取集成进 fcitx5 插件(clipboard addon),删除外部工具依赖#961
H-Chris233 merged 4 commits into
Open-Less:betafrom
aeoform:feat/linux-selection-fcitx-clipboard

Conversation

@aeoform

@aeoform aeoform commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

背景

Linux 划词追问此前依赖外部工具(wl-paste / xclip / xsel)读取 PRIMARY selection,未安装时功能不可用,且与 fcitx 剪贴板模块的选区来源不一致。

改动

fcitx5 插件(openless.cpp)

  • 新增 DBus 方法 GetSelectionText():直接读 fcitx clipboard addon 的 PRIMARY 选区缓存
  • 与 fcitx 剪贴板模块来源完全一致(X11 XFIXES 事件 + convertSelection,Wayland data-control zwlr/ext 双协议),跨发行版 / 桌面环境统一
  • 不触碰用户剪贴板(只读 PRIMARY 缓存,不做模拟复制)
  • CMake 增加 Fcitx5::Module::Clipboard 依赖

Rust 侧

  • selection.rs Linux 分支改走插件 GetSelectionText(DBus 带超时,失败自动视为无选区)
  • 删除外部工具路径(wl-paste/xclip/xsel)及 linux_selection_tools_missing 提醒机制
  • 前端 selection_warning 状态机、i18n 文案、相关测试一并删除
  • acceptQaSessionEvent idle 分支不再依赖 selection_warning 字段,一律视为新会话 token(事件保序,与旧语义等价)

顺带修复

  • 打字提问路径(QA 面板 / less-computer)不再 emit Polishing capsule:回答在面板内可见,避免 Linux 输入法 auxDown 闪「✨ 润色中...」(语音路径保留原反馈)

验证

  • 本机 KDE Wayland(fcitx5 5.1.21)实测:选中文字 → GetSelectionText 返回正确文本;同窗口改选后返回新文本(XFIXES/data-control 缓存新鲜度正确)
  • cargo check / tsc / 前后端测试全部通过

@aeoform
aeoform force-pushed the feat/linux-selection-fcitx-clipboard branch from 6d82220 to 56da02a Compare August 17, 2026 04:44
@H-Chris233 H-Chris233 self-assigned this Aug 18, 2026
aeoform and others added 3 commits August 19, 2026 11:45
- openless 插件新增 GetSelectionText DBus 方法:直读 fcitx clipboard addon
  的 PRIMARY 选区缓存(X11 XFIXES / Wayland data-control 统一维护),与
  fcitx 剪贴板模块来源一致,不触碰用户剪贴板
- CMake 增加 Fcitx5::Module::Clipboard 依赖
- Rust 侧 selection 改走插件 GetSelectionText,删除 wl-paste/xclip/xsel
  外部工具路径及 linux_selection_tools_missing 提醒机制(前端
  selection_warning 状态机、i18n、测试一并删除)
- acceptQaSessionEvent 的 idle 分支不再依赖 selection_warning 字段,
  一律视为新会话 token(事件保序,语义等价)
- 打字提问路径(QA 面板 / less-computer)不再 emit Polishing capsule:
  回答在面板内可见,避免 Linux 输入法 auxDown 闪「✨ 润色中...」

(cherry picked from commit 384f8876a490cb3e8e992af05cdad33f2af6a8ec)
(cherry picked from commit 7e8bf825c08f5e935c7a25746c121136d92b7926)
(cherry picked from commit d13403343b08fe1b4070e0f0d2f219a0a69d363e)
@aeoform
aeoform force-pushed the feat/linux-selection-fcitx-clipboard branch 3 times, most recently from 2d646a6 to 7161114 Compare August 19, 2026 03:57
- capsule 反馈参数从裸 bool 改为具名枚举 CapsuleFeedback(Show/Hide):
  语音/听写路径 Show、打字路径 Hide,调用点自文档化,避免将来误传
- AppImage 插件子路径提取为 APPIMAGE_PLUGIN_SUBDIR 常量并注明与 CI
  bundle.resources 的契约,避免三处硬编码静默失配
- selection.rs 移除文件级 Linux 大赦(lib.rs 的 crate 级兜底仍在),
  Duration import 按平台限定,消除 Linux unused 隐患
@H-Chris233
H-Chris233 merged commit 33467a3 into Open-Less:beta Aug 19, 2026
6 of 8 checks passed
@aeoform
aeoform deleted the feat/linux-selection-fcitx-clipboard branch August 19, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants