SanYe-SanJiu/dsh-power-switch ↗★ 0

dsh-power-switch

实现侧边栏一键关机与启动模式切换 仅限Windows用户,适合需要快速关闭DSH或调整窗口启动模式的任务。

套件
dsh-power-switch
相容性
待驗證
Harness 依賴範圍
>=0.1.6-alpha.2 <0.1.7-0 || >=0.1.7-0 <0.2.0-0
版本
1.1.4
授權
MIT
最近更新
2026年9月24日

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:SanYe-SanJiu/dsh-power-switch

Configuration

The card's configuration page, or the loader row's config::

KeyDefaultMeaning
launchModetabWindow for the next launch: tab or app
delayMs1000Milliseconds to wait after answering before the exit begins. The answer itself needs 1200 ms to reach the browser, so that is the floor: 0 means "as soon as the answer is out", and anything below 1200 waits 1200
exitCode0The status the DSH process ends with, for whatever started it — a shell ($LASTEXITCODE), a service manager, a script. 0 is success, so a non-zero value is for a wrapper that wants to tell "the person closed DSH" apart from a crash
hardfalseSkip the graceful path and end the process at once

launchMode is switched from the card. The other three are edited from the card's own Advanced settings block, which writes them to settings.json in the state directory. That block exists because it is the only UI for those three on a DSH that generates settings forms (0.1.7) — a plugin without a declared schema gets no generated form, so without it they would be editable only by hand-editing the profile patch. On a host that still has the registered-namespace settings API, the same save is written to the settings document as well, so the two surfaces cannot disagree; the recorded value is the one that governs, and deleting settings.json hands the decision back to the loader row's config: and the settings document.

The card sends no delay of its own: delayMs governs every exit, the card's buttons included. (It used to send 700 ms "so the interface reacts sooner" — a number that could not matter, being below the 1200 ms the answer needs, and that silently outranked the setting.) A caller that wants a one-off delay can still put delayMs in the shutdown request body, which outranks the setting for that request only. With hard, the process ends after that same wait instead of after the watchdog.

Environment variables:

VariableMeaning
DSH_POWER_SWITCH_NO_WINDOW=1Do not open a window for this launch
DSH_POWER_SWITCH_WINDOW_HANDLED=1Another process is opening this launch's window; the launcher and the supervisor set it, and the plugin then opens no second window
DSH_POWER_SWITCH_CLIThe dsh CLI entry, for a machine with no recorded launch command
DSH_POWER_SWITCH_PORTPort to probe (default 3080)
DSH_POWER_SWITCH_LAUNCH_MODE, _DELAY, _HOST_LOG, _HANDSHAKEInternal interface between the helper and the supervisor; no configuration needed