← Back to Skills Marketplace
427
Downloads
0
Stars
0
Active Installs
6
Versions
Install in OpenClaw
/install dkey-switch
Description
AI 窗口切换技能。用于定位并激活 Windows 上的目标窗口,支持智能模糊匹配、窗口查找、进程匹配、句柄激活与标签切换回退。
README (SKILL.md)
核心定位
本技能可以 直接执行窗口切换动作,而非仅提供快捷键建议。
关键特性:
- 智能模糊匹配:支持缩写(如"企微"→"企业微信")、拼音首字母、跳跃匹配
- 双步安全流程:先
find-window确认,再activate-window激活 - 精确回退机制:激活失败时自动降级到
Dalt或Dctrl
命令速查表
| 命令 | 用途 | 示例 |
|---|---|---|
find-window \x3C关键字> [数量] [--json] |
首选:查找候选窗口 | find-window 企微 3 --json |
activate-window \x3C关键字> [序号] [--json] |
激活指定候选 | activate-window 企微 1 --json |
activate-process \x3C进程名> [--json] |
按进程名激活 | activate-process Code --json |
activate-handle \x3C句柄> [--json] |
精确句柄激活 | activate-handle 0x2072C --json |
list-windows [--json] |
列出所有窗口 | list-windows --json |
Dalt -N |
Alt+Tab 切换 N 次 | Dalt -1 |
Dctrl -N |
Ctrl+Tab 标签切换 | Dctrl -1 |
AI 标准操作流程(重要)
Step 1: 总是先执行 find-window
scripts\d-switch.cmd find-window \x3C用户关键词> 5 --json
Step 2: 分析返回结果
情况 A:完全匹配(高置信度)
- 条件:
items[0].title与用户说的窗口名基本一致 - 操作:直接激活,无需询问用户
情况 B:部分匹配(需确认)
- 条件:有候选结果,但第一项不完全匹配用户描述
- 操作:列出候选列表,询问用户确认
情况 C:无匹配
- 条件:
count == 0或status == "not_found" - 操作:尝试更通用关键词,或告知用户未找到
Step 3: 执行激活
# 用户确认后(或高置信度直接激活)
scripts\d-switch.cmd activate-window \x3C关键词> \x3C用户选择的序号> --json
流程图
用户:"切到企微文档"
↓
AI:执行 find-window "企微" 5 --json
↓
检查 items[0]:
├─ 标题 ≈ "企业微信-文档" → 直接 activate-window "企微" 1
├─ 标题不匹配 → 列出列表让用户选择
└─ 无结果 → 尝试其他关键词或告知未找到
模糊匹配规则
支持的匹配类型
| 类型 | 说明 | 示例 |
|---|---|---|
| 缩写/别名 | 内置常见应用别名 | "企微"→"企业微信", "vx"→"微信" |
| 跳跃匹配 | 字符顺序一致即可 | "qiyou"→"企业微信" |
| 子串匹配 | 包含即可 | "微信"→"企业微信" |
| 连字符兼容 | - _ 自动忽略 |
"企业微信文档"→"企业微信-文档" |
内置别名表
| 别名 | 匹配目标 |
|---|---|
| 企微, 企业微 | 企业微信 |
| wx, vx | 微信 |
| QQ, TIM | |
| code, vscode | Visual Studio Code |
| vs | Visual Studio |
| idea | IntelliJ IDEA |
| chrome | Google Chrome |
| edge | Microsoft Edge |
| wt, 终端 | Windows Terminal |
| cmd | Command Prompt |
状态处理与错误恢复
JSON 返回状态
| status | 含义 | 处理建议 |
|---|---|---|
ok |
查找成功 | 检查 items 内容决定下一步 |
activated |
激活成功 | 流程结束 |
not_found |
未找到 | 尝试别名/更短关键词 |
choice_out_of_range |
序号越界 | 重新查找获取有效序号 |
activation_failed |
激活失败 | 重试1次,仍失败则降级 Dalt -1 |
退出码
| 码 | 含义 |
|---|---|
| 0 | 成功 |
| 1 | 参数错误 |
| 2 | 未找到目标 |
| 3 | 找到但激活失败 |
| 4 | 候选序号越界 |
典型场景示例
场景 1:用户说"切到企微"
# AI 执行:
scripts\d-switch.cmd find-window "企微" 3 --json
# 假设返回 items[0].title = "企业微信"
# 判定:完全匹配 → 直接激活
scripts\d-switch.cmd activate-window "企微" 1 --json
场景 2:用户说"切到文档"(有多个候选)
# AI 执行:
scripts\d-switch.cmd find-window "文档" 5 --json
# 假设返回多个:WPS文档、企业微信-文档、VS Code文档...
# 判定:不完全确定 → 询问用户
# AI 回复:找到以下窗口,请确认:
# 1. WPS文档
# 2. 企业微信-文档
# 3. VS Code - document.txt
# 请输入序号(1-3):
# 用户回复:2
scripts\d-switch.cmd activate-window "文档" 2 --json
场景 3:用户说"切到浏览器"
# AI 执行:
scripts\d-switch.cmd find-window "浏览器" 3 --json
# 返回:Chrome、Edge、Firefox...
# 判定:有歧义 → 询问用户
场景 4:只知道进程名
# 适合标题频繁变化的应用(如 VS Code)
scripts\d-switch.cmd activate-process "Code" 1 --json
场景 5:窗口内切换标签
# 先激活窗口,再切标签
scripts\d-switch.cmd activate-window "chrome" 1 --json
scripts\d-switch.cmd Dctrl -1
非触发场景(不执行脚本)
以下情况不应调用本技能:
- 用户仅询问快捷键知识(如"Alt+Tab 是什么")
- 用户仅讨论原理/概念(如"怎么切换窗口"但无执行意图)
- 用户明确说"不要执行"
平台兼容性
| 平台 | 入口 | 备注 |
|---|---|---|
| Windows | scripts\d-switch.cmd ... |
首选 |
| PowerShell | powershell -File scripts/d-switch.ps1 ... |
备选 |
| Git Bash/WSL | bash scripts/d-switch.sh ... |
兼容 |
| macOS | 无脚本支持 | 降级为快捷键建议 |
最佳实践
- 总是先 find-window:除非用户明确指定了进程名或句柄
- 优先使用 --json:便于程序化解析结果
- 高置信度直接执行:第一项完全匹配时无需询问
- 低置信度询问确认:有候选但不完全匹配时列出选项
- 失败时友好提示:未找到时建议用户可能的关键词
快速参考卡
用户:"切到XXX"
↓
find-window "XXX" 5 --json
↓
items[0] 匹配? ──Yes──→ activate-window "XXX" 1
│
No
↓
列出选项询问用户
↓
activate-window "XXX" \x3C用户选择>
Usage Guidance
This package claims to run PowerShell-based window-activation commands but the core runtime scripts it references (scripts/d-switch.ps1 and scripts/d-switch.cmd) are missing from the bundle. Before installing or enabling this skill: 1) Ask the author to provide the missing PowerShell (.ps1) and CMD entry (.cmd) files and a clear install/verification procedure. 2) Inspect those scripts for any network activity, remote downloads, credential use, or commands beyond window activation (SendKeys/Win32 calls are expected; anything that reads unrelated config, posts to a URL, or executes downloads is suspicious). 3) Verify on a test machine that the scripts do only UI/window operations and that no external endpoints are contacted. 4) Note the skill is Windows-specific—ensure your environment matches. If the author cannot produce the missing scripts or they must be sourced elsewhere, treat the skill as untrusted until you can review the actual runtime code.
Capability Analysis
Type: OpenClaw Skill
Name: dkey-switch
Version: 1.1.4
The skill bundle is a legitimate tool for Windows window management, allowing an AI agent to find, list, and activate windows or processes. It utilizes PowerShell (specifically System.Windows.Forms.SendKeys and Win32 APIs) to automate Alt+Tab and Ctrl+Tab sequences, which is consistent with its stated purpose. The bundle includes extensive documentation, a comprehensive alias mapping for various industries (scripts/aliases.json), and a self-audit script (scripts/security-audit.sh) to ensure file integrity and command consistency. No evidence of malicious intent, data exfiltration, or harmful prompt injection was found.
Capability Assessment
Purpose & Capability
The declared purpose (Windows window activation) matches the need for PowerShell, alias tables, and local scripts. However, the runtime instructions and many docs require scripts/d-switch.ps1 and scripts/d-switch.cmd which are not present in the file manifest. Also the skill has no OS restriction despite being Windows-specific. The absence of the core entry scripts is a material inconsistency: either the package is incomplete or the skill expects external binaries not provided.
Instruction Scope
SKILL.md explicitly instructs the agent to run commands like scripts\d-switch.cmd find-window ... and to always run find-window first. The only executable included is a bash wrapper (scripts/d-switch.sh) which itself calls scripts/d-switch.ps1 — that .ps1 is missing. The docs/assets instruct the agent to read USER.md and MEMORY.md at session start (those files exist), which is reasonable for preferences, but the primary runtime commands point to non-existent files; attempting to follow the instructions will fail or cause the agent to search for/attempt to create/obtain those scripts (undocumented).
Install Mechanism
No install spec in registry (instruction-only), which is lower risk. SKILL.md metadata includes a suggested winget install entry for PowerShell (reasonable). There is no evidence of remote downloads or extraction in the provided files. The main risk here is not the install mechanism itself but the package incompleteness (missing .ps1/.cmd) which may lead integrators to source those components elsewhere.
Credentials
The skill requests only a powershell binary and lists no environment variables, credentials, or external endpoints. The aliases and docs reference local files (USER.md, MEMORY.md) which are present and reasonable for preferences. No secret/credential access is requested, which is proportionate for the stated purpose.
Persistence & Privilege
Flags are default (always:false, agent-invocable allowed). The skill does not request permanent presence or system-wide settings. There is no evidence it modifies other skills' configs or requests elevated privileges in the manifest.
How to Use
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install dkey-switch - After installation, invoke the skill by name or use
/dkey-switch - Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.1.4
**v1.1.4 brings major documentation, workflow, and feature clarity updates.**
- Added extensive internal documentation and reference files (assets/ and references/), including guides on agents, onboarding, patterns, and memory.
- Introduced new scripts for process automation, including alias definitions and security auditing.
- Overhauled SKILL.md to highlight a new workflow: always attempt intelligent fuzzy matching and window listing prior to activation, with explicit JSON result handling and clarifications on fallback procedures.
- Explicitly documented fuzzy matching rules, built-in alias examples, and improved step-by-step AI operation protocols.
- Clarified non-trigger scenarios to avoid unintended activation and expanded usage examples for typical user requests.
v1.1.3
- Major simplification: removed 12 documentation, script, and reference files.
- Skill scope, usage, and command mapping unchanged.
- Now only the core metadata and documentation remain; implementation scripts and agent/reference docs have been removed.
v1.1.2
dkey-switch 1.1.2
- 精简和优化了技能文档,明确核心用途为 AI 直接激活 Windows 窗口,不再长篇举例和规则冗余。
- 明确所有命令支持 `--json`,便于上层流程自动决策和恢复。
- 细化了不同目标信息(窗口关键词、进程名、句柄、无明确目标)时的推荐调用方式和决策流。
- 强化“非触发”场景描述,避免误触发。
- 增加元数据,补充依赖项、安装推荐和 argument-hint。
- 统一并精简参数默认值、出错状态、退出码约定,并给出高价值命令用例。
v1.1.1
- 增加典型 AI 调用模板与决策分流(如“AI 决策模板(Canonical)”段落),提升自动化编排一致性
- 新增扩展触发短语与误触发排除规则,明确技能调用边界
- 明确 JSON 状态输出和退出码规范,为衔接多步智能编排提供标准接口
- 优化参数约定与触发流程,细化交互提示和功能说明
- 文档结构梳理,更易读,面向编排和 AI 系统清晰区分各使用场景
- 新增参考用例文档(references/ai-e2e-cases.md)
v1.1.0
**Summary:** Expanded from basic hotkey simulation to smart window/tab activation with refined system routing, richer commands, and Windows/macOS logic.
- 新增 activate-window、find-window、list-windows 等更精确的窗口/标签定位命令,支持关键词/进程名/句柄操作
- 调用路径升级:Windows 优先直接激活指定窗口(不再只靠 Dalt/Dctrl 热键循环);macOS 自动降级为快捷键说明
- 详细区分操作系统,明确每个平台首选命令与兼容路径,提升执行智能度和兼容性
- 路由与判定规则全面升级:目标窗口已知优先直接激活、不明确时先 find 再 activate,热键模拟作为兜底方案
- 技能文档全面更新,注重典型使用、命令示例、系统分流与场景细化
v1.0.0
dkey-switch 1.0.0
- 首次发布,支持通过命令实现窗口(Dalt)和标签页(Dctrl)切换。
- 自动响应“查看/切换/定位”窗口与页签相关指令,无需用户手动操作。
- 提供高优先级意图命中,优先执行自动切换命令。
- 支持灵活次数的切换,推荐逐步定位目标窗口或标签页。
Metadata
Frequently Asked Questions
What is Dkey Switch?
AI 窗口切换技能。用于定位并激活 Windows 上的目标窗口,支持智能模糊匹配、窗口查找、进程匹配、句柄激活与标签切换回退。 It is an AI Agent Skill for Claude Code / OpenClaw, with 427 downloads so far.
How do I install Dkey Switch?
Run "/install dkey-switch" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Dkey Switch free?
Yes, Dkey Switch is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Dkey Switch support?
Dkey Switch is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Dkey Switch?
It is built and maintained by ddmy (@ddmy); the current version is v1.1.4.
More Skills