Skip to content

fix(linux): fcitx5 热键拦截修复 + 去除 Linux 磨砂效果 + 剪贴板清理#601

Merged
H-Chris233 merged 4 commits into
Open-Less:betafrom
aeoform:fix/linux-fcitx5-hotkey-intercept-and-cleanup
Jun 6, 2026
Merged

fix(linux): fcitx5 热键拦截修复 + 去除 Linux 磨砂效果 + 剪贴板清理#601
H-Chris233 merged 4 commits into
Open-Less:betafrom
aeoform:fix/linux-fcitx5-hotkey-intercept-and-cleanup

Conversation

@aeoform
Copy link
Copy Markdown
Contributor

@aeoform aeoform commented Jun 5, 2026

User description

变更

fcitx5 插件 — 修复 Alt+a 热键泄漏字符

  • 根因Key::check("Alt+a") 存储 sym=97(小写 a),但 Alt 状态下实际按键 sym=65(大写 A),不匹配导致 filterAndAccept 未执行
  • 修复:自定义组合键匹配时字母大小写归一化比较
  • 使用 PreInputMethod 阶段 + filterAndAccept(),在引擎 InputMethod 之前拦截

Linux 视觉

  • 去除 backdrop-filter(WebKitGTK 下局部重绘时不可靠,[linux] 磨砂效果有问题 #553),换不透明白底
  • 删除 [data-ol-no-compositing] CSS fallback 规则
  • 删除 is_no_compositing_mode Rust command 及前端调用

Linux 剪贴板

  • 流式插入完成后不再写最终文本到系统剪贴板(fcitx5 已直写)
  • Linux insert() 路径纯 fcitx5 commit,失败不 fallback 剪贴板

CI 流程

  • Release 时单独上传 fcitx5 插件 (libopenless.so + openless.conf) 作为独立 artifact,供 AppImage 用户手动安装

其他

  • 删除 StartupShell 启动加载界面

关联 Issue

Closes #553 - Linux 磨砂效果有问题
Closes #540 - Linux 启动 pill 无法水平居中(移除 pill 直接解决)

🤖 Generated with Claude Code


PR Type

Bug fix, Enhancement


Description

  • Fix fcitx5 Alt+a hotkey character leak by normalizing case and using PreInputMethod + filterAndAccept

  • Remove backdrop-filter (WebKitGTK unreliable); replace with opaque background

  • Skip clipboard writes after Linux streaming insert; fcitx5 commits directly

  • Move audio cue listener to main window (AudioCueListener) for Linux compatibility

  • Upload fcitx5 plugin as standalone CI artifact for AppImage users


Diagram Walkthrough

flowchart LR
  A["openless.cpp: PreInputMethod + case normalization"] --> B["Key event filtered and accepted"]
  C["insertion.rs: Linux path (fcitx5 only)"] --> D["No clipboard fallback"]
  E["AudioCue.tsx: Listen on main window"] --> F["capsule:state events trigger cues"]
  G["release-tauri.yml: Upload fcitx5 plugin artifact"] --> H["AppImage users can install manually"]
Loading

File Walkthrough

Relevant files
Enhancement
3 files
coordinator.rs
Emit capsule:state to main window for AudioCueListener     
+4/-1     
AudioCue.tsx
Add AudioCueListener component for recording sound cues   
+81/-0   
FloatingShell.tsx
Render AudioCueListener in FloatingShellBody                         
+2/-0     
Bug fix
4 files
dictation.rs
Skip clipboard save on Linux after streaming insert           
+3/-2     
insertion.rs
Refactor insertion to separate Linux and Windows paths     
+22/-18 
Capsule.tsx
Remove audio cue logic from Capsule component                       
+2/-57   
openless.cpp
Fix hotkey matching by normalizing key case                           
+19/-43 
Configuration changes
1 files
release-tauri.yml
Upload fcitx5 plugin as separate release artifact               
+13/-0   

…ard cleanup

- fcitx5 plugin: fix Alt+a hotkey leaking 'a' character by normalizing
  case comparison (Alt produces uppercase sym, Key::check expects lowercase)
- fcitx5 plugin: use PreInputMethod + filterAndAccept to block engine
  before commit happens (same strategy as clipboard addon)
- Linux: remove backdrop-filter (unreliable on WebKitGTK, Open-Less#553),
  replace with opaque background
- Linux: skip clipboard writes after streaming insert (fcitx5 commits
  directly, clipboard fallback corrupts user data)
- SettingsModal: render via React Portal to document.body (Open-Less#580, fixes
  scrollbars overlapping modal)
- Remove is_no_compositing_mode command and CSS fallback (no longer needed)
- Remove StartupShell loading screen (app renders FloatingShell immediately)

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

github-actions Bot commented Jun 5, 2026

PR Reviewer Guide 🔍

(Review updated until commit 1033130)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

553 - PR Code Verified

Compliant requirements:

  • 移除了 backdrop-filter,替换为不透明背景

Requires further human verification:

  • 视觉最终效果无法通过代码审查确认,需要人工验证

540 - Fully compliant

Compliant requirements:

  • 移除了 StartupShell 启动加载界面(pill),直接消除居中需求
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Missing fallback

Linux insert 路径完全依赖 fcitx commit_text,失败时直接返回 Failed,不再像旧代码那样回退到剪贴板粘贴。如果 fcitx5 插件未安装、未加载或 commit 失败,用户将完全无法插入文字(甚至不会尝试复制到剪贴板)。虽然 PR 有意放弃回退,但缺少降级路径可能会使依赖此功能的用户(例如不想 / 无法运行 fcitx5 的用户)完全失去输入能力。

/// Linux 路径:仅走 fcitx5 CommitText 直写。无剪贴板 fallback。
#[cfg(target_os = "linux")]
pub fn insert(
    &self,
    text: &str,
    _restore_clipboard_after_paste: bool,
    _paste_shortcut: PasteShortcut,
) -> InsertStatus {
    if text.is_empty() {
        return InsertStatus::CopiedFallback;
    }
    match crate::linux_fcitx::commit_text(text) {
        Ok(()) => InsertStatus::Inserted,
        Err(e) => {
            log::warn!("[insertion] fcitx commit_text failed: {e}");
            InsertStatus::Failed
        }
    }
}

- Add upload step for libopenless.so + openless.conf as a separate
  artifact (openless-fcitx5-plugin-linux-x64) for AppImage users
  and manual installation
- Include plugin files in GitHub Release assets alongside existing
  deb/rpm/AppImage bundles

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

github-actions Bot commented Jun 5, 2026

Persistent review updated to latest commit 1658af4

@aeoform
Copy link
Copy Markdown
Contributor Author

aeoform commented Jun 5, 2026

#580 实际上没有被修复。

- AudioCueListener is a new component rendered in FloatingShellBody
  that listens to capsule:state on the main window, so the record
  start cue works on Linux where the capsule window is hidden.
- Coordinator now emits capsule:state to both "capsule" and "main"
  windows so the listener receives state changes.
- Remove duplicate audio cue logic from Capsule.tsx to avoid
  double-triggering on macOS/Windows where capsules are shown.

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

github-actions Bot commented Jun 5, 2026

Persistent review updated to latest commit ac65011

@aeoform
Copy link
Copy Markdown
Contributor Author

aeoform commented Jun 5, 2026

录音提示音不发出声音的问题Linux 上被修复了。

@aeoform
Copy link
Copy Markdown
Contributor Author

aeoform commented Jun 5, 2026

现在linux上唯一的已知问题是输入法在频繁切换焦点时,会在某些情况下出现一些无法消失的输入框,需要重启输入法才能解决

@H-Chris233
Copy link
Copy Markdown
Collaborator

磨砂我去除了,你解决下冲突我就合

Accept beta's WindowChrome/global.css/FloatingShell changes for Linux
surface treatment, re-apply AudioCueListener component on top.

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

github-actions Bot commented Jun 6, 2026

Persistent review updated to latest commit 1033130

@H-Chris233 H-Chris233 merged commit 9bfed9a into Open-Less:beta Jun 6, 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.

[linux] 磨砂效果有问题 Linux WebKitGTK 启动图标无法居中(viewport 宽度异常)

2 participants