When using DSH Desktop or dsh --profile web, application hangs or the need to reset service state is a common scenario. On desktop, you usually need to close the window or use terminal commands; in Web mode, restarting the process often involves manual operation. This plugin provides one-click restart capability on the settings page through DSH’s official interface, without requiring Shell permissions.
This is a DSH plugin maintained by user y2zyyr. Its core purpose is to insert a “Restart DSH” button into DSH Desktop’s “General Settings”, leveraging DSH’s official graceful restart mechanism to support process restarts in both desktop and pure Web modes.
Core Features¶
- General Settings Integration: Registers the official slot
settings.general.iteminSettings → General, providing a native confirmation dialog and single-flight protection (button disabling). - Desktop Mode Restart: Calls
ctx.desktopRuntime.requestRestart(), performs graceful Cordis teardown, thenapp.relaunch()+app.exit(0). - Web Mode Restart: Generates a detached launcher, sends itself a SIGTERM signal, triggering the graceful shutdown logic in the CLI’s built-in handler, then waits for the old process to exit before re-executing argv and cwd.
- Security and Privacy: Does not execute shell commands (such as kill/pkill), communicates only via loopback HTTP routes, and does not read credentials or perform telemetry.
Installation and Enablement¶
- Edit
~/.dsh/profiles/web/package.jsonand add todependencies:
"@y2zyyr/dsh-restart-control": "link:/path/to/dsh-restart-control"
- Add
@y2zyyr/dsh-restart-controltodsh.profile.bundles. - Run
pnpm installin the profile configuration directory. - Restart DSH Desktop to activate the new plugin.
Note: DSH Desktop ≥ 2.0.2 requires the dependency key to exactly match the package name @y2zyyr/dsh-restart-control.
Typical Usage¶
Open the settings page, click the button and confirm; you can check the status { ok, restartable, mode } via GET /dsh-restart-control/status.
Applicable Scenarios and Notes¶
- Desktop Mode: Must run in
compatibilityoradvancedmode, where thedesktopRuntimeservice is provided. - Web Mode: Restarts the server process itself and relies on a real Node host process; if the launcher fails, the route returns 500.
- Dependency Version: The DSH core package must be
^0.1.0-rc.6.
This plugin is open-sourced under the MIT license and focuses on providing a non-invasive, secure restart experience. For more details, refer to the catalog page or the GitHub repository.