@gd-kirie/tray

中文文档
0.15.0发布于 2026/10/21TypeScriptES Module构建来源已验证近 30 天下载 4979
原始使用文档

@gd-kirie/tray

@gd-kirie/tray adds system tray icons and menus to desktop Kirie applications. It uses the application's existing Eventa context.

Install

Install the package in a Kirie project:

pnpm add @gd-kirie/tray

Add the plugin to kirie.config.ts:

import tray from "@gd-kirie/tray/plugin";
import { defineKirieConfig } from "kirie";
import core from "kirie/plugin/core";

export default defineKirieConfig({
  plugins: [core, tray],
});

Install the plugin dependencies:

pnpm kirie doctor --fix plugin:tray

This command installs the Godot addon and the GdKirie.Tray NuGet package. The plugin supports macOS, Windows, and Linux on x64 and Arm64. Linux requires a StatusNotifierItem host.

Use

In Godot, register and attach the adapter. Create a client with the application's Eventa context:

import { createTrayClient } from "@gd-kirie/tray";

const client = createTrayClient(context);
const open = await client.createMenuItem({ text: "Open" });
const menu = await client.createMenu({ items: [open] });
const tray = await client.createTray({
  icon: { kind: "resource", path: "res://tray.svg" },
  menu,
  tooltip: "My application",
});

const stopEvents = client.onEvent((event) => {
  if (event.type === "menu" && event.id === open.id) {
    console.log("Open");
  }
});

Keep res://tray.svg in the Godot project. Call stopEvents() when the page closes. Release browser handles with close() when they are no longer needed.

See GdKirie.Tray for C# usage and the tray example for a complete application.

版本与发布记录

@gd-kirie/tray 共发布 6 个版本,首次发布于 2026/10/11;过去 12 个月发布了 6 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.15.0latest2026/10/2125 天前
0.14.12026/10/1729 天前
0.13.02026/10/131 个月前
0.12.02026/10/121 个月前
0.11.02026/10/111 个月前
0.0.0-stage2026/10/111 个月前

关于 @gd-kirie/tray 的常见问题

如何安装 @gd-kirie/tray?

在项目目录运行 npm install @gd-kirie/tray,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:kirie(^0.15.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@gd-kirie/tray 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@gd-kirie/tray 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@gd-kirie/tray 可以商用吗?

@gd-kirie/tray 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@gd-kirie/tray 的下载量有多少?

根据 npm 官方下载统计,@gd-kirie/tray 在 2026/10/16 – 2026/11/14 这 30 天内被下载 4,979 次,日均约 166 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gd-kirie/tray 还在维护吗?

最新版本 0.15.0 发布于 2026/10/21(25 天前);至今共发布 6 个版本,其中过去 12 个月发布了 6 个;首次发布于 2026/10/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。