Skip to main content
S

dsh-config-autostart

samuel-shao/dsh-config-autostart

Starts DeepSeek Harness with only the tray icon when you sign in to Windows: it writes a per-user logon entry, closes the main window right after it appears so the app keeps running in the tray, and adds a Start on sign-in switch under Settings → General. Windows desktop only. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.

Install

dsh plugin --profile web add github:samuel-shao/dsh-config-autostart

README

dsh-config-autostart

登录 Windows 后自动启动 DeepSeek Harness,但只留系统托盘图标,不弹主界面。

它做什么

  1. 在 HKCU\Software\Microsoft\Windows\CurrentVersion\Run 写入一条登录项(当前用户,不需要管理员)。
  2. 登录项调用 %USERPROFILE%\.dsh-config-autostart\boot-hide.vbs:用 wscript.exe 起 PowerShell(窗口样式 0),全程不闪控制台。
  3. boot-hide.ps1 启动桌面端可执行文件,轮询该进程的主窗口;一旦主窗口出现,就发 WM_CLOSE。
  4. 桌面端自己的关闭处理会把窗口隐藏到托盘、进程继续运行——和手动点右上角关闭按钮完全一致。

工具 config_autostart 提供 status / enable / disable / probe / hide_now 五个动作。

设置页开关

「设置 → 通用」里有一行 开机自动启动 勾选框(客户端 bundle client/client.js 注册在 settings.general.item 槽位,order 90):

  • 勾选 → POST /dsh-config-autostart/enable,写登录项与启动脚本;
  • 取消 → POST /dsh-config-autostart/disable,删登录项;
  • GET /dsh-config-autostart/status 返回 { ok, enabled, state },行内显示「已开启 / 未开启」,失败时行内报错并可重试。

三个路由只接受同源请求:POST 带 Origin/Referer 且主机不是 127.0.0.1 / localhost / ::1 时直接 403,防止外来网页替用户勾选。

名称约定

插件名、工具名、登录项值名、运行时目录、日志与启动输出文件统一用 config-autostart:

位置名称
插件 id / 客户端 idconfig-autostart / dsh-config-autostart
对话工具config_autostart
登录项值名DSHConfigAutostart
运行时目录%USERPROFILE%\.dsh-config-autostart\
运行日志%USERPROFILE%\.dsh\log\dsh-config-autostart.log
登录启动输出%TEMP%\dsh-config-autostart.boot.log

enable 会顺带清掉旧名(DSHTrayAutostart、~\.dsh-tray-autostart、旧日志与旧启动输出),一台机器上不会残留两份登录项。

为什么不是“隐藏启动”

桌面端的启动流程总是创建并显示主窗口(没有登录项 API,也没有 --hidden 之类的开关),所以“只留托盘”只能通过关闭主窗口完成。窗口会显示约 0.1–2 秒再收进托盘。

关键取舍

  • 不会误关欢迎窗:未登录时的欢迎窗“关闭即退出应用”,脚本按窗口结构(可缩放 + 可最大化)只认主窗口,绝不匹配欢迎窗。
  • 已在运行就不动:登录时若已有 DSH 在跑,脚本直接退出,不重复启动、不隐藏用户已打开的窗口。
  • 一次性提示:桌面端第一次“关闭到托盘”会弹一次说明框并写标记文件。enable 会预先写下这个标记(%APPDATA%\@deepseek-ai\dsh-desktop\background-close-confirmed),让开机那次不等人点确认。
  • 可回退:disable 只删登录项,%USERPROFILE%\.dsh-config-autostart\ 下的脚本保留;卸载插件不会自动删登录项,需先 disable。

文件

路径作用
index.js主机插件:config_autostart 工具、登录项读写、脚本落地
assets/boot-hide.ps1启动/隐藏脚本(启动、-Probe、-HideExisting 三种模式)
%USERPROFILE%\.dsh-config-autostart\boot-hide.ps1运行时副本
%USERPROFILE%\.dsh-config-autostart\boot-hide.vbs无窗口启动用的 wscript 外壳
%USERPROFILE%\.dsh\log\dsh-config-autostart.log运行日志(JSON 行)

限制

  • 仅 Windows(os: win32);登录后启动,不是开机即启动(托盘应用需要用户会话)。
  • 主窗口会短暂可见;桌面端若改了窗口创建逻辑(例如将来加了隐藏启动开关),应以新开关为准。
  • 需要当前用户对 HKCU 有写权限(默认有),不需要管理员。

Related plugins