日期:2026-08-13
sample.llm-command-palette 这类常显组件空闲时会挡住桌面点击。宿主用 Win32 RegisterHotKey 提供进程级全局快捷键,并在内存中维护会话可交互覆盖层,热键切换不再走 UpdateWidgetLayoutAsync。
flowchart LR
MessageWnd["UI-thread hidden HWND"]
Runtime["IDesktopRuntime"]
Session["WidgetSessionOverlay"]
Surfaces["RuntimeSurfaceController / WidgetWindow"]
Config["hotkeys.json"]
Layout["layout.json"]
UI["Tray / Management / Local API"]
MessageWnd -->|"HotkeyPressed"| Runtime
UI --> Runtime
Runtime --> Session
Runtime --> Surfaces
Runtime --> Config
Surfaces -.->|"不写"| Layout
IDesktopRuntime。IRuntimeEventBus 只做事后通知,不当命令总线。HotkeyService 只负责 RegisterHotKey / UnregisterHotKey 和 WM_HOTKEY 消息窗口,不解析业务动作。RegisterHotKey,也不使用 WH_KEYBOARD_LL。| 状态 | 存储 | 进程重启 |
|---|---|---|
| 快捷键绑定 | %AppData%\DesktopEnhancer\config\hotkeys.json |
保留 |
| 会话可交互 / 会话显隐 | 内存 WidgetSessionOverlay |
丢弃,回到空闲穿透 |
| 布局点击穿透 / 可见性 | layout.json |
保留 |
EditMode 或 SafeInputMode → 强制可点(clickThrough = false)clickThrough = !Interactablelayout.ClickThrough有启用的 widget.toggleInteractable 绑定时,目标实例启动即写入会话覆盖 Interactable = false,因此即使 layout.clickThrough = false 也会空闲穿透。管理窗口或本地 API 显式改 layout.ClickThrough 时,会把会话覆盖同步为 Interactable = !clickThrough,让窗口立刻可点或穿透。
HotkeyService 必须在 WPF UI 线程创建隐藏顶层窗口并调用 RegisterHotKey。HWND_MESSAGE 或线程池上的 hwnd=0 会使注册看起来成功,但 WM_HOTKEY 永远进不了消息循环。
Ctrl+Shift+K → widget.toggleInteractable → sample.llm-command-paletteAlt+Space 作为默认绑定widget.toggleInteractablewidget.toggleVisible(会话显隐,不写 layout.json)runtime.toggleEditModeruntime.toggleSafeInputMode