* feat(linux): 选区读取集成进 fcitx5 插件(clipboard addon),删除外部工具依赖 - 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) * fix(linux): bundle and sync fcitx5 selection plugin (cherry picked from commit 7e8bf825c08f5e935c7a25746c121136d92b7926) * fix(linux): use DBus selection reader during validation (cherry picked from commit d13403343b08fe1b4070e0f0d2f219a0a69d363e) * refactor(linux): 收尾 PR 961 审查发现的小毛病 - capsule 反馈参数从裸 bool 改为具名枚举 CapsuleFeedback(Show/Hide): 语音/听写路径 Show、打字路径 Hide,调用点自文档化,避免将来误传 - AppImage 插件子路径提取为 APPIMAGE_PLUGIN_SUBDIR 常量并注明与 CI bundle.resources 的契约,避免三处硬编码静默失配 - selection.rs 移除文件级 Linux 大赦(lib.rs 的 crate 级兜底仍在), Duration import 按平台限定,消除 Linux unused 隐患 --------- Co-authored-by: Chris233 <h-chris233@outlook.com>
69 lines
2.4 KiB
Bash
Executable File
69 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Inject fcitx5 plugin files into Linux packages at system paths.
|
|
# Usage: ./inject-fcitx5-plugin.sh <package-path>
|
|
#
|
|
# Supports: .deb, .rpm
|
|
# AppImage resources are bundled separately and installed to ~/.local/ at runtime.
|
|
set -euo pipefail
|
|
|
|
PKG="$1"
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
PLUGIN_DIR="$SCRIPT_DIR/linux-fcitx5-plugin/build_release"
|
|
SO_SRC="$PLUGIN_DIR/libopenless.so"
|
|
CONF_SRC="$PLUGIN_DIR/openless.conf"
|
|
|
|
if [ ! -f "$SO_SRC" ] || [ ! -f "$CONF_SRC" ]; then
|
|
echo "[inject-fcitx5] Plugin not built — run build.sh first. Skipping."
|
|
exit 0
|
|
fi
|
|
|
|
TARGET_CONF="/usr/share/fcitx5/addon/openless.conf"
|
|
|
|
case "$PKG" in
|
|
*.deb)
|
|
# Detect multiarch triplet for the target architecture
|
|
MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null || echo "")
|
|
if [ -n "$MULTIARCH" ]; then
|
|
TARGET_LIB="/usr/lib/$MULTIARCH/fcitx5/libopenless.so"
|
|
else
|
|
TARGET_LIB="/usr/lib/fcitx5/libopenless.so"
|
|
fi
|
|
echo "[inject-fcitx5] Injecting into deb ($MULTIARCH): $PKG"
|
|
TMPDIR=$(mktemp -d)
|
|
trap 'rm -rf "$TMPDIR"' EXIT
|
|
dpkg-deb -R "$PKG" "$TMPDIR"
|
|
mkdir -p "$TMPDIR/$(dirname "$TARGET_LIB")"
|
|
mkdir -p "$TMPDIR/$(dirname "$TARGET_CONF")"
|
|
cp "$SO_SRC" "$TMPDIR/$TARGET_LIB"
|
|
cp "$CONF_SRC" "$TMPDIR/$TARGET_CONF"
|
|
dpkg-deb -b "$TMPDIR" "$PKG"
|
|
echo "[inject-fcitx5] Done — deb updated"
|
|
;;
|
|
*.rpm)
|
|
TARGET_LIB="/usr/lib64/fcitx5/libopenless.so"
|
|
echo "[inject-fcitx5] Injecting into rpm: $PKG"
|
|
TMPDIR=$(mktemp -d)
|
|
trap 'rm -rf "$TMPDIR"' EXIT
|
|
cd "$TMPDIR"
|
|
rpm2cpio "$PKG" | cpio -idm 2>/dev/null || true
|
|
mkdir -p "$(dirname ".$TARGET_LIB")"
|
|
mkdir -p "$(dirname ".$TARGET_CONF")"
|
|
cp "$SO_SRC" ".$TARGET_LIB"
|
|
cp "$CONF_SRC" ".$TARGET_CONF"
|
|
if command -v rpmrebuild &>/dev/null; then
|
|
rpmrebuild -np -d "$TMPDIR" "$PKG" 2>/dev/null || {
|
|
echo "[inject-fcitx5] ERROR: rpmrebuild failed" >&2
|
|
exit 1
|
|
}
|
|
else
|
|
echo "[inject-fcitx5] ERROR: rpmrebuild not found — required for RPM injection. Install it with: sudo dnf install rpmrebuild" >&2
|
|
exit 1
|
|
fi
|
|
echo "[inject-fcitx5] Done — rpm updated"
|
|
;;
|
|
*)
|
|
echo "[inject-fcitx5] Unknown package format: $PKG (supported: .deb, .rpm)"
|
|
exit 1
|
|
;;
|
|
esac
|