Skip to content
luxp1990Public

About

Windows 全局快捷键管理与鼠标手势贴图工具 (.NET 8 WPF)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Vector — 全局快捷键与鼠标手势贴图工具 / Global Hotkey & Gesture Pin Tool (v2.1.0)

中文说明 | English

License: MIT .NET 8.0 Platform: Windows Release: v2.1.0


Tip

懒得手动挑版本、解压、配 MCP? 你可以直接复制下方的 🤖 AI Agent 一键安装与 MCP 接入 Prompt 发给你的 AI 编程助手(Antigravity / Claude Code / Codex / Cursor 等),让它自动检测本机 .NET 8 环境、下载部署并完成 MCP 配置!

如果你受够了每次打开常用工具都要在一堆图标和窗口里来回翻找,或者只是想把一段报错、一张参考图临时钉在屏幕最前面却要按好几步截图再贴图,不妨试试 Vector。


💡 为什么要写这个软件?

日常写代码、看文档、做对比的时候,有两个高频小动作一直让人很不爽:

  • 频繁切应用太打断思路:常用的终端、脚本、文件夹、网页工具分散在桌面和浏览器里,每次用都要切窗口、找图标;市面上的启动器要么功能太重、要么热键管理不够直观。
  • 临时对照参考太繁琐:看到一段参数、一张图表或报错信息,想随手把它「钉」在屏幕最前面边看边写,传统工具往往要先按截图快捷键、再框选、再点「贴图」——手已经从鼠标挪到键盘又挪回鼠标了。

于是干脆自己写了 Vector —— 一个常驻系统托盘的轻量级 Windows 工具,只保留最直接、最高频的两个能力:

  • 一套极简全局快捷键:把常用程序、文件夹、网页和脚本绑到顺手的组合键上,一键直达,还支持总开关一键暂停/恢复、前置应用智能避让,以及高权限窗口穿透。
  • 一笔鼠标手势直接贴图:按住鼠标右键逆时针画一个方框,松开手,框里的内容立刻变成一张置顶贴图留在原地——不用切工具、不用敲键盘,单手一气呵成。

基于 .NET 8 (WPF) + WinForms NotifyIcon 原生构建,单进程运行、无外部依赖,支持简体中文 / English、深色 / 浅色主题以及响应式窄屏布局,同时内置 Model Context Protocol (MCP) 命名管道服务。

Vector 主界面


🎯 核心玩法:鼠标手势贴图

手势贴图是 Vector 最核心、也最顺手的功能——全程只需要鼠标右键:

  1. 按住鼠标右键不放;
  2. 在屏幕上逆时针画一个方框(闭合的近似矩形即可,支持跨多显示器绘制);
  3. 松开鼠标右键,方框内的屏幕内容就会立刻被截取并原位变成一张置顶贴图!

Vector 鼠标手势贴图演示

贴图交互与补充方式

  • 贴图窗口操作:左键拖动任意移动位置,鼠标滚轮调节透明度(25% ~ 100%),右键 / 双击 / Esc / Delete 一键关闭。
  • 快捷键框选 & 剪贴板贴图:除了手势画框,也支持 Ctrl+Alt+A 框选贴图与 Ctrl+Alt+S 一键贴出剪贴板图片(均可在设置中自定义,并支持开启「截图后自动复制到剪贴板」)。
  • 多屏与高分屏像素级对齐:完整适配多显示器虚拟桌面与 125%~250% DPI 缩放,贴图原位严丝合缝,无 DWM 截屏残影。

📦 下载与使用

前往本仓库的 Releases 页面 下载单文件绿色版(解压后仅包含单个 Vector.exe,双击即可运行;配置与日志位于 %AppData%\Vector\):

发布包 发布模式 运行环境要求 特点说明
Vector-v2.1.0-win-x64.zip 默认完整版 (self-contained) 无需预装 .NET 内置 .NET 8 运行时,开箱即用
Vector-v2.1.0-win-x64-light.zip 轻量版 (framework-dependent) 需预装 .NET 8 Desktop Runtime (x64) 依赖系统运行时,体积显著更小

🤖 AI Agent 一键安装与 MCP 接入 Prompt

将以下提示词直接复制发送给支持终端/文件操作的 AI Agent(如 Antigravity、Claude Code、Codex、Cursor 等),它会自动检测你的 .NET 8 Desktop Runtime 环境、推荐最合适的版本、完成下载部署,并可选帮你配置好 MCP 接入:

请帮我在当前 Windows 电脑上选择、下载、部署开源项目 **Vector**(`https://github.com/luxp1990/Vector`),并按需为我配置好 **MCP 接入**。

### 1. 环境检测(先检查再推荐)
请先通过终端执行检查,不要猜测:
1. 确认系统为 **Windows x64**(Vector 仅支持 Windows x64)。
2. 检查是否已安装 **.NET 8 Desktop Runtime (x64)**:
   - 运行 `dotnet --list-runtimes`,查看输出中是否包含 `Microsoft.WindowsDesktop.App 8.`(注意:仅有 `Microsoft.NETCore.App 8.` 不够,WPF 需要 `WindowsDesktop` 运行时)。
   - 如果 `dotnet` 命令不存在,也可检查 `C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\` 下是否存在 `8.*` 目录。

### 2. 版本选择与选项确认(先问我再执行)
根据检测结果,向我清晰对比并推荐以下两个**单文件绿色版**(均无需安装向导,解压后仅一个 `Vector.exe`,配置与日志保存在 `%AppData%\Vector\`):
- **默认完整版(`Vector-v*-win-x64.zip`,约 68 MB)**:内置 .NET 8 运行时,无需预装任何环境,开箱即用。
  - 👉 **未检测到 .NET 8 Desktop Runtime 时优先推荐此版本**。
- **轻量版(`Vector-v*-win-x64-light.zip`,约 1.8 MB)**:体积小巧,依赖系统已安装的 .NET 8 Desktop Runtime (x64)。
  - 👉 **已检测到 .NET 8 Desktop Runtime 时优先推荐此版本**(若未安装但我想用轻量版,可先用 `winget install Microsoft.DotNet.DesktopRuntime.8` 安装运行时)。

在开始下载前,请向我确认:
1. 选择 **完整版** 还是 **轻量版**;
2. 解压放置目录(默认建议 `%LocalAppData%\Programs\Vector` 或用户指定的工具目录,避免放进临时目录);
3. 是否需要创建 **桌面 / 开始菜单快捷方式** 或 **开机自启**;
4. 是否需要顺便为我配置 **MCP 接入**(让当前 AI 客户端可以通过 MCP 管理 Vector 快捷键)。

### 3. 自动下载与部署
确认后,请自动完成以下操作:
1. 通过 GitHub API(`https://api.github.com/repos/luxp1990/Vector/releases/latest`)或 `gh release download -R luxp1990/Vector` 获取最新 Release 资产,下载对应 `.zip` 包(若网络受限,提示我或使用镜像后再继续)。
2. 将压缩包解压到目标目录,确认 `Vector.exe` 存在并清理临时压缩包。
3. 按我的选择创建快捷方式,并启动 `Vector.exe`。

### 4. 配置 MCP 接入(如我选择开启)
Vector 内置命名管道 MCP 服务端(`Vector.Mcp`,仅限当前用户 SID)与 stdio 桥接模式(`Vector.exe --mcp-bridge`),**默认全关**:
1. 请帮我在当前使用的 AI 客户端(如 Antigravity / Claude Desktop / Cursor / Codex 等)的 MCP 配置文件中添加如下服务(将路径替换为实际安装路径):
   ```json
   {
     "mcpServers": {
       "vector": {
         "type": "stdio",
         "command": "<目标安装目录>\\Vector.exe",
         "args": ["--mcp-bridge"]
       }
     }
   }
   ```
2. 提醒我在 Vector 主界面的 **设置面板** 中手动开启 **MCP 命名管道服务**(`McpEnabled`);如果需要 AI 增删改快捷键或执行目标,按需开启 `McpAllowWrites` / `McpAllowExecute` 并在设置中复制 `McpToken`。
3. 如客户端支持热加载或需重启生效,提示我重启/刷新 MCP 连接,并尝试调用 `get_status` 或 `list_shortcuts` 验证连通性。

### 5. 完成汇报
最后简明告知我:安装路径、配置/日志目录(`%AppData%\Vector\`)、MCP 接入状态,以及常用默认操作(程序启动后常驻系统托盘,按住鼠标右键逆时针画框即可手势贴图)。

✨ 核心特性

  • ⌨️ 全局快捷键管理:
    • 支持 Ctrl / Alt / Shift / Win 任意组合,录入时实时捕获按键并自动过滤系统保留键(如 Ctrl+C、Alt+F4、F5)。
    • 支持 程序(.exe / 含参数与工作目录)、文件夹、网页(http/https)、任意文件/脚本(.bat/.cmd/.ps1/.vbs) 四种目标类型,拖入自动识别并解开 .lnk / .url 快捷方式。
    • 提供独立全局开关热键(如 Ctrl+Alt+V)与分功能开关,一键临时暂停/恢复监听;支持单步撤回(Ctrl+Z)、类型排序与 JSON 导入导出。
  • 🛡️ 智能避让与 UIPI 提权:
    • 支持全屏态与指定前台进程(如微信、Chrome、Excel、VS Code 等)热键避让,不抢占应用自身快捷键;全局开关热键绝不让渡。
    • 支持「以管理员模式启动」自举 UAC 提权,使热键可穿透作用于高权限窗口。
  • 🎨 现代桌面交互:
    • 托盘常驻 + 实时状态指示(监听中/已暂停),支持深色 / 浅色主题与简体中文 / English 实时切换,窄窗口下自动切换顶部紧凑栏与收纳设置面板。
  • 🔌 原生 MCP 服务:
    • 内置命名管道服务端(Vector.Mcp,仅限当前用户 SID)与 Vector.exe --mcp-bridge stdio 桥接,默认全关,写/执行工具需显式开启并校验 McpToken。

🛠️ 构建、测试与架构

目录结构

Vector/
├─ App.xaml(.cs)            应用入口 / DI / 单实例 / 提权 / 异常兜底
├─ MainWindow.xaml(.cs)     主窗口 UI、响应式布局与设置面板
├─ Vector.csproj            项目文件 (net8.0-windows, WPF + WinForms)
├─ Models/                  AppSettings / PinSettings / ShortcutConfig / UndoEntry
├─ Services/                热键 / 手势 / 截图 / 贴图编排 / 设置 / 执行 / 主题 / MCP
├─ Windows/                 贴图设置 / 轨迹层 / 框选层 / 贴图窗口
├─ Resources/               中英文词典、图标与演示动图
├─ Themes/                  Dark.xaml / Light.xaml / Styles.xaml
└─ tests/                   run_all.py 与 Vector.RegressionTests 契约测试工程

本地构建与发布

# 还原依赖并编译 Release
dotnet build Vector.csproj -c Release

# 运行(首次建议管理员身份以获得完整热键穿透能力)
dotnet run -c Release

# 发布默认完整版单文件 → publish/Vector.exe
dotnet publish Vector.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o publish

# 发布轻量版单文件 → publish-light/Vector.exe
dotnet publish Vector.csproj -c Release -r win-x64 --self-contained false -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o publish-light

# 运行全量回归测试(编译 + GestureOverlayWindow 契约测试 + 真实进程集成验证)
python tests\run_all.py

🤖 MCP 接入配置示例

先启动 Vector 并在设置面板中开启 MCP 命名管道服务。当主程序未运行或未开启 MCP 时,--mcp-bridge 会输出 JSON-RPC 错误并退出。

{
  "mcpServers": {
    "vector": {
      "type": "stdio",
      "command": "C:\\Path\\To\\Vector.exe",
      "args": ["--mcp-bridge"]
    }
  }
}
工具名称 类别 所需开关 需传 token 说明
list_shortcuts / get_status / export_config 只读 McpEnabled 否 查询快捷键、监听状态与导出配置
add_shortcut / update_shortcut / delete_shortcut / set_listening / import_config 写操作 McpEnabled + McpAllowWrites 是 增删改快捷键、切换监听与导入配置
execute_shortcut 高危执行 McpEnabled + McpAllowExecute 是 按索引或热键直接执行目标

📄 开源协议与版本历史

本项目采用 MIT License 开源协议。

  • v2.1.0 (2026-11-27)
    • 新增响应式窄屏布局、独立设置面板(SettingsOverlay)、自定义滚动条与输入框占位提示优化。
    • 新增 ShortcutTargetNameConverter 列表名称/路径双行展示与中英文多语言资源完善。
    • 集成原生 MCP 命名管道服务与 --mcp-bridge stdio 桥接模式。
    • GitHub Releases 新增 framework-dependent 轻量版单文件发布包。
  • v2.0.2 (2026-11-05)
    • 多显示器跨屏手势轨迹完整显示、原位精准贴图、高分屏像素级对齐与 DWM 截屏帧同步消残影。
  • v2.0.1 (2026-09-29)
    • 修复手势遮罩窗空闲态未离屏导致系统被误判为 QUNS_BUSY 的问题。

Tip

Want an AI Agent to handle setup for you? Copy the 🤖 AI Agent Install & MCP Setup Prompt below into your AI coding assistant (Antigravity, Claude Code, Codex, Cursor, etc.) to automatically check your .NET 8 runtime, download & deploy Vector, and configure MCP integration!

Tired of digging through desktop icons and cluttered windows just to launch your daily tools, or going through multiple shortcuts just to pin an error snippet or reference chart on top of your screen? Give Vector a try.


💡 Why I Built Vector

Two small everyday friction points pushed me to build this:

  • Switching windows breaks flow: Terminals, scripts, project folders, and web tools are scattered everywhere. Most launchers feel either too bloated or clunky when it comes to managing and pausing global hotkeys.
  • Pinning a quick reference takes too many steps: Whenever you want to keep a piece of code, a parameter table, or an error log pinned on top while working, traditional screenshot tools force you to hit a hotkey, drag a selection, and click "Pin" — moving your hand back and forth between keyboard and mouse.

So I built Vector — a lightweight Windows tray utility focused on doing just two things cleanly:

  • A minimal global hotkey manager: Bind programs, folders, URLs, and scripts to clean key combos, with a single global toggle hotkey, smart foreground-app yielding, and optional UAC elevation.
  • One-stroke mouse gesture pinning: Hold the right mouse button and draw a box counterclockwise — release it, and the enclosed region immediately becomes a topmost floating pin in place.

Built natively on .NET 8 (WPF) + WinForms NotifyIcon as a single self-contained process with Simplified Chinese / English UI, Dark / Light themes, a responsive narrow-window layout, and an integrated Model Context Protocol (MCP) named-pipe server.

Vector Main UI


🎯 Core Feature: Mouse Gesture Pinning

Gesture pinning is Vector's signature workflow — all you need is your right mouse button:

  1. Hold the right mouse button;
  2. Draw a box counterclockwise on the screen (any closed approximate rectangle works, even across multiple monitors);
  3. Release the right mouse button, and everything inside the box is captured and pinned right in place on top!

Vector Mouse Gesture Pin Demo

Pin Interactions & Alternatives

  • Pin window controls: Left-drag to move, mouse wheel to adjust opacity (25%–100%), and right-click / double-click / Esc / Delete to close.
  • Region & clipboard hotkeys: In addition to mouse gestures, you can use Ctrl+Alt+A for region capture or Ctrl+Alt+S to pin an image from your clipboard (both customizable in settings, with an optional "Auto-copy capture to clipboard" toggle).
  • Multi-monitor & HiDPI pixel alignment: Full virtual-desktop support and crisp alignment under 125%–250% DPI scaling without DWM capture artifacts.

📦 Download & Usage

Download the single-file portable package from Releases (each archive contains a single Vector.exe; config and logs are stored in %AppData%\Vector\):

Package Publish Mode Runtime Requirement Notes
Vector-v2.1.0-win-x64.zip Default Full (self-contained) None Bundles .NET 8 runtime; ready to run out of the box
Vector-v2.1.0-win-x64-light.zip Light (framework-dependent) .NET 8 Desktop Runtime (x64) Significantly smaller download size

🤖 AI Agent Install & MCP Setup Prompt

Copy and paste this prompt into any terminal-capable AI agent (e.g., Antigravity, Claude Code, Codex, Cursor). It will inspect your .NET 8 Desktop Runtime, recommend the right package, deploy Vector, and optionally wire up MCP integration:

Help me choose, download, and deploy **Vector** (`https://github.com/luxp1990/Vector`) on this Windows machine, and optionally configure **MCP integration**.

### 1. Environment Check (Inspect First)
Run terminal checks before making recommendations:
1. Verify the OS is **Windows x64** (Vector only supports Windows x64).
2. Check whether **.NET 8 Desktop Runtime (x64)** is installed:
   - Run `dotnet --list-runtimes` and look for `Microsoft.WindowsDesktop.App 8.` (note: `Microsoft.NETCore.App 8.` alone is not enough for WPF).
   - If `dotnet` is not on PATH, also check `C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\` for an `8.*` folder.

### 2. Version & Options Confirmation (Ask Me First)
Based on the check, compare and recommend one of the two **single-file portable builds** (no installer wizard; each zip extracts to a single `Vector.exe`, with config/logs stored in `%AppData%\Vector\`):
- **Default Full (`Vector-v*-win-x64.zip`, ~68 MB)**: Self-contained with .NET 8 runtime bundled; ready to run out of the box.
  - 👉 **Recommend this if `.NET 8 Desktop Runtime` is NOT detected**.
- **Light (`Vector-v*-win-x64-light.zip`, ~1.8 MB)**: Much smaller download; requires `.NET 8 Desktop Runtime (x64)`.
  - 👉 **Recommend this if `.NET 8 Desktop Runtime` IS detected** (or offer to install it via `winget install Microsoft.DotNet.DesktopRuntime.8`).

Before downloading, ask me to confirm:
1. **Full** or **Light** build;
2. Target directory (suggest `%LocalAppData%\Programs\Vector` or a user-chosen tools folder);
3. Whether to create **Desktop / Start Menu shortcuts** or enable **launch on startup**;
4. Whether to configure **MCP integration** so my AI client can manage Vector shortcuts.

### 3. Download & Deploy
Once confirmed:
1. Fetch the latest release from `https://api.github.com/repos/luxp1990/Vector/releases/latest` (or `gh release download -R luxp1990/Vector`) and download the chosen `.zip` asset.
2. Extract `Vector.exe` into the target directory and remove the temporary `.zip`.
3. Create any requested shortcuts and launch `Vector.exe`.

### 4. Configure MCP Integration (If Requested)
Vector includes a built-in named-pipe MCP server (`Vector.Mcp`, scoped to the current user SID) and a stdio bridge (`Vector.exe --mcp-bridge`), **disabled by default**:
1. Add the following entry to my AI client's MCP config file (Antigravity, Claude Desktop, Cursor, Codex, etc.), replacing the path with the actual install location:
   ```json
   {
     "mcpServers": {
       "vector": {
         "type": "stdio",
         "command": "<Target-Install-Dir>\\Vector.exe",
         "args": ["--mcp-bridge"]
       }
     }
   }
   ```
2. Remind me to enable **MCP** (`McpEnabled`) in Vector's Settings panel (and optionally enable `McpAllowWrites` / `McpAllowExecute` and copy `McpToken` if write/execute tools are needed).
3. Prompt me to reload/restart the MCP client if needed, then verify connectivity by calling `get_status` or `list_shortcuts`.

### 5. Summary
Summarize the install path, config/logs folder (`%AppData%\Vector\`), MCP setup status, and basic usage (runs in the system tray; hold right mouse button and draw a box counterclockwise to pin any screen region).

✨ Key Features

  • ⌨️ Global Hotkey Management:
    • Supports any combination of Ctrl / Alt / Shift / Win with live key capture and automatic filtering of reserved system keys (Ctrl+C, Alt+F4, F5, etc.).
    • Supports Programs (.exe with arguments & working dir), Folders, Web URLs (http/https), and Files/Scripts (.bat/.cmd/.ps1/.vbs), with drag-and-drop auto-detection and .lnk / .url resolution.
    • Includes an independent Global Toggle Hotkey (e.g. Ctrl+Alt+V), per-feature toggles, single-step Undo (Ctrl+Z), type sorting, and JSON import/export.
  • 🛡️ Foreground App Yielding & UIPI Elevation:
    • Automatically yields ordinary hotkeys when fullscreen apps or configured foreground apps (WeChat, Chrome, Excel, VS Code, etc.) are active, while never yielding the global toggle hotkey.
    • Optional "Run as Administrator" UAC self-elevation so hotkeys work over elevated windows.
  • 🎨 Modern Desktop UX:
    • System tray residence with live status indicator (Listening / Paused), instant Dark / Light theme and Chinese / English switching, and a responsive compact layout with a dedicated Settings overlay.
  • 🔌 Native MCP Server:
    • Built-in named-pipe MCP server (Vector.Mcp, restricted to the current user SID) and Vector.exe --mcp-bridge stdio bridge. Disabled by default; write/execute tools require explicit opt-in and McpToken verification.

🛠️ Build, Test & Architecture

# Build Release
dotnet build Vector.csproj -c Release

# Run (elevated recommended for full UIPI hotkey coverage)
dotnet run -c Release

# Publish self-contained single file -> publish/Vector.exe
dotnet publish Vector.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o publish

# Publish framework-dependent light single file -> publish-light/Vector.exe
dotnet publish Vector.csproj -c Release -r win-x64 --self-contained false -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o publish-light

# Run full regression suite (build + GestureOverlayWindow contract tests + integration)
python tests\run_all.py

🤖 MCP Client Configuration

Start Vector and enable MCP in the Settings panel. If Vector is not running or MCP is disabled, --mcp-bridge outputs a JSON-RPC error and exits cleanly.

{
  "mcpServers": {
    "vector": {
      "type": "stdio",
      "command": "C:\\Path\\To\\Vector.exe",
      "args": ["--mcp-bridge"]
    }
  }
}
Tool Category Required Flags token Required Description
list_shortcuts / get_status / export_config Read-only McpEnabled No Query shortcuts, status, and export config
add_shortcut / update_shortcut / delete_shortcut / set_listening / import_config Write McpEnabled + McpAllowWrites Yes Manage shortcuts, toggle listening, import config
execute_shortcut Execute McpEnabled + McpAllowExecute Yes Execute a target by index or hotkey

📄 License & Changelog

Licensed under the MIT License.

  • v2.1.0 (2026-11-27): Responsive narrow layout, Settings overlay, custom scrollbars, target name/path display, complete ZH/EN i18n, native MCP server & --mcp-bridge, and light release build.
  • v2.0.2 (2026-11-05): Multi-monitor gesture trace, in-place pixel-accurate pinning, HiDPI alignment, and DwmFlush capture sync.
  • v2.0.1 (2026-09-29): Fixed idle gesture overlay triggering QUNS_BUSY fullscreen detection.

About

Windows 全局快捷键管理与鼠标手势贴图工具 (.NET 8 WPF)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages