插件系统

作者 mcx 日期 2026-07-22
插件系统

插件系统

Qx 支持通过插件扩展功能。插件运行在沙盒环境中,通过 context.* 接口调用宿主能力。


安装插件

从市场安装

  1. 唤起 Qx → 输入「设置」→ Enter
  2. 进入 扩展 页面
  3. 浏览插件市场,点击安装

手动安装

.qx-plugin.zip 包拖入 Qx 窗口,或在设置中点击 导入


内置插件

插件 说明
V2EX 浏览 V2EX 帖子
天气 查看天气预报
Qx Bing Wallpaper 每日壁纸
Calendar 日历
Brew macOS 包管理器

开发插件

目录结构

插件位于 ~/.qx/plugins/<id>/

1
2
3
4
~/.qx/plugins/my-plugin/
├── manifest.json # 插件清单
├── index.js # 入口文件
└── assets/ # 资源文件(可选)

manifest.json

1
2
3
4
5
6
7
8
{
"id": "my-plugin",
"name": "My Plugin",
"description": "A sample plugin",
"version": "1.0.0",
"author": "Your Name",
"permissions": ["cli", "http", "storage"]
}

核心 API

接口 用途 权限
context.cli 执行本地命令 cli
context.http HTTP 请求 http
context.storage 持久化存储 storage
context.showNotification(msg) 显示通知
context.closePlugin() 关闭插件

Workbench 模式

插件可以声明 Workbench 布局,显示列表+详情的双栏视图:

1
2
3
4
5
6
7
8
9
10
context.workbench.show({
items: [
{ id: "1", title: "Item 1", subtitle: "Description" },
{ id: "2", title: "Item 2", subtitle: "Description" }
],
detail: {
title: "Detail View",
body: "Content here"
}
});

从 Raycast 转换

Qx 支持将 Raycast 扩展转换为 Qx 插件:

1
node scripts/convert-raycast-extension.mjs /path/to/extension --out /tmp/qx-out --package

发布插件

推送到 mcxen/qx-plugins 仓库,即可在市场中出现。


文档


← 截图与录屏 · 从源码构建 →