npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-desktop-restart

v0.1.0

Published

Tray restart command for DSH Desktop

Readme

dsh-desktop-restart

English

DSH Desktop 插件:在系统托盘菜单中添加 重启 DSH Desktop…,无需再手动找可执行文件重启应用。

功能

  • 在原生托盘菜单的 工具(Tools) 分组中添加重启命令
  • 菜单文案随桌面语言切换(English / 中文)
  • 重启进行中会禁用菜单项,避免重复触发
  • 通过 Cordis 与 bundle patch 接入 DSH Desktop

环境要求

  • 支持插件的 DSH Desktop
  • 本地开发需要 Node.js >=22.0.0 和 Yarn 1.x

安装

在 DSH Desktop 托盘 → Open DSH Terminal 中执行以下命令之一:

# npm(发布后推荐)
dsh plugin add dsh-desktop-restart

# GitHub(首次安装可能需要放行构建脚本)
dsh plugin add github:SanShuiGieGie/dsh-desktop-restart

# 本地开发
dsh plugin add link:/path/to/dsh-desktop-restart

安装完成后,请完全退出并重新打开 DSH Desktop,插件才会生效。

本地开发安装

使用 link: 时需先构建插件:

cd /path/to/dsh-desktop-restart
yarn install
yarn run build
dsh plugin add link:/path/to/dsh-desktop-restart

然后完全退出并重新打开 DSH Desktop。

说明: 若在 Node 23 上 yarn install 因依赖的 engines 检查失败,本仓库已提供 .yarnrc(ignore-engines true)。也可改用 Node 22 LTS 或 Node 24+。

使用

  1. 打开 DSH Desktop 托盘菜单。
  2. 点击 Restart DSH Desktop…(桌面语言为中文时显示 重启 DSH Desktop…)。
  3. DSH Desktop 会先正常退出,再自动重新启动。

重启请求处理期间,该菜单项会暂时禁用。

卸载

dsh plugin remove dsh-desktop-restart

卸载后同样需要重启 DSH Desktop。

开发

# 安装依赖
yarn install

# 编译 TypeScript 到 lib/
yarn run build

# 运行单元测试
yarn run test

# 仅类型检查(不输出文件)
yarn run typecheck

# 完整检查(构建 + 导出验证 + 类型检查 + 测试)
yarn run check

项目结构

| 路径 | 说明 | |------|------| | src/index.ts | Cordis 插件入口 — 监听 desktopRuntime 并挂载托盘项 | | src/host/tray.ts | 在原生托盘中注册重启命令 | | src/host/locale.ts | 中英文托盘文案 | | cordis.patch.yml | 将插件插入 DSH Desktop 的 Cordis bundle | | tests/ | Vitest 单元测试 |

工作原理

DSH Desktop 会在 Cordis 上下文中提供 desktopRuntime 服务。本插件:

  1. 等待 desktopRuntime 就绪(或在其后续出现时响应)。
  2. 通过 registerTrayItem() 注册托盘项,分组为 tools,排序为 30。
  3. 点击时调用 desktopRuntime.requestRestart(),先 orderly 地关闭 Cordis,再由 Electron 重新启动。

插件通过 cordis.patch.yml 注入桌面 bundle:

- insert:
    - id: desktop-restart
      name: dsh-desktop-restart

许可

MIT