Skip to content

[windows] 全局快捷键监听失败不应被乐观标记为成功 #18

Closed

Description

@Cooper-X-Oak

现象

  • 触发条件:Windows 上启动 OpenLess,依赖全局快捷键开始/停止录音。
  • 当前表现:非 macOS 热键监听使用 rdev::listen,但在监听真正启动前就向 supervisor 汇报成功;如果 listen 后续失败,只写日志,不会清空 inner.hotkey,supervisor 也不会重试。
  • 证据:openless -all/app/src-tauri/src/hotkey.rs 非 macOS 分支:
let _ = status_tx.send(true);
let result = listen(move |event: Event| {
    dispatch_event(&cb_shared, &tx, event);
});
if let Err(err) = result {
    log::error!("[hotkey] rdev::listen 启动失败: {:?}", err);
}

coordinator.rs 在收到 Ok(monitor) 后会认为 hotkey listener 已安装,并退出 supervisor loop。

影响

  • Windows 全局快捷键如果安装失败,用户只会看到“按快捷键无响应”。
  • 后端不会自动重试,也不会把错误传播到 UI 或权限页。
  • 日志之外没有可观察状态,难以定位是权限、rdev hook、键位映射还是录音链路的问题。

建议接受标准

  • 非 macOS 分支只有在全局监听确实可用时才向 supervisor 汇报成功,或提供可检测的失败回调。
  • rdev::listen 失败后能触发重试,或把 hotkey 状态暴露给 UI。
  • 设置页展示全局快捷键监听状态:已安装、失败、重试中。
  • Windows 上热键失败时,用户能看到明确错误提示,而不是功能静默无响应。

TODO / 不确定项

  • TODO:确认是否继续使用 rdev,还是改用 global-hotkey 或 Win32 RegisterHotKey 作为 Windows 专用实现。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions