dsh-power-control: Restart/Shutdown DSH Next to the Session Title Bar

Introduction

On the right side of the session title bar in DeepSeek Harness (DSH), right next to the sidebar toggle, you can now place two buttons: Restart and Close. This plugin injects UI into the DSH client to provide a control entry point for the current host process. Its goal is to let users restart or close DSH directly from the DSH interface without switching to the desktop or hunting for a process manager, making it ideal for development and debugging scenarios that require frequent restarts/closures of DSH.

What This Is

dsh-power-control is a DSH bundle plugin consisting of dsh.bundle.patch + dsh.client, maintained by WUXUANHAN. It injects a single line of plugin via cordis.patch and renders two buttons at the far left of the client session title bar. The buttons are positioned adjacent to the sidebar toggle switch. Dark/light themes follow DSH’s alias tokens — no hard-coded colors.

Core Features

  • Renders two buttons at the far left of the session title bar: Restart / Close.
  • Restart: After user confirmation, the frontend issues a POST /restart request; the host launches a detached script, and the process exits and restarts within 4–5 seconds. The page polls /status and automatically calls location.reload() once reconnected.
  • Close: After user confirmation, the frontend issues a POST /shutdown request; the detached script first calls CloseMainWindow(), then force-kills as a fallback after 4 seconds. The page displays “Exited”.
  • All actions are performed by the host; the browser only sends a single request, requiring no additional permissions.
  • Supports the environment variable DSH_POWER_CONTROL_DRY=1 for dry-run mode (logs only, no process manipulation).
  • Supports specifying a custom executable to launch: environment variable DSH_POWER_CONTROL_EXE.
  • Log path: %TEMP%\dsh-power-control.

Installation & Enablement

This plugin is a DSH bundle (dsh.bundle.patch + dsh.client), with two installation methods:

# Option 1: Plugins → Add plugin → select this directory
# Option 2: For local development, link it into the profile

After installation, open a new session and the buttons will appear. If they don’t, check whether the dsh-power-control entry in Plugins is enabled.

Typical Usage

  • After installation, you’ll see two buttons on the left side of any session title bar.
  • Click “Restart”: a confirmation dialog appears; upon confirmation, the DSH process exits and restarts within 4–5 seconds, and the page refreshes automatically.
  • Click “Close”: a confirmation dialog appears; upon confirmation, the DSH process first attempts a graceful shutdown, then is force-killed after 4 seconds. The page displays “Exited”.
  • Dry-run test: Set the environment variable DSH_POWER_CONTROL_DRY=1 before launching DSH. The script will only write logs without touching any process.
  • Check status: After launching DSH, visit GET /dsh-power-control/api/status (requires GUI login session). It returns pid, execPath, argv, as well as the parsed launch command launch.exe / launch.source.

Use Cases & Notes

  • Ideal for developers and debugging scenarios that require frequent restarts or closures of DSH.
  • The plugin runs with the permissions of the current DSH process. Review the source code and license (MIT) before installation.
  • Dark/light themes follow DSH’s alias tokens — no extra configuration needed.

Conclusion

dsh-power-control provides Restart and Close buttons right next to the sidebar toggle in the session title bar, helping developers quickly control the DSH process. Directory page and GitHub link: https://www.skillhub.cn/plugins/WUXUANHAN/dsh-power-control, https://github.com/WUXUANHAN/dsh-power-control.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye