Preface¶
DSH (DeepSeek Harness) is DeepSeek’s desktop client, featuring a plugin-based architecture. In daily use, the window’s position and size often vary upon each startup, disrupting the workflow. The dsh-window-state plugin addresses this issue by allowing users to specify the window’s startup state in the settings.
Core Features¶
This plugin adds a “Startup Window State” option under “Settings → General Settings” in the DSH desktop client.
Users can choose to open the window in “Default”, “Maximized”, or “Fullscreen” mode at every startup. The user’s preference is persistently stored in localStorage (key: dsh-window-state:startup) and takes effect immediately upon startup or when the setting is modified.
Installation and Activation¶
Install the plugin via CLI:
dsh plugin install github:gaoyian7251/dsh-window-state
After installation, the desktop client must be restarted for the changes to take effect.
Usage¶
After restarting the DSH client, open “Settings → General Settings”.
1. Locate the “Startup Window State” row.
2. Select “Default / Maximized / Fullscreen”.
3. The selection applies immediately to the current window and is saved. It will be automatically applied on the next startup.
Note: When “Default” is selected, the window retains the last position and size remembered by Electron.
How it Works¶
The DSH desktop main window is created by the Electron main process. Decompiled verification reveals that the dsh-desktop:window-fullscreen channel is a one-way notification, and the main process code does not provide an entry point for fullscreen/maximization for plugins to call. Therefore, this plugin adopts a “cross-process mechanism”: it locates and controls the window from a child process via Win32 API (user32.dll).
Specific steps:
1. Use EnumWindows to locate the main window by window class Chrome_WidgetWin_1 and a title containing DeepSeek Harness.
2. Use ShowWindowAsync to send SW_MAXIMIZE or SW_RESTORE commands.
3. Fullscreen mode is achieved by stripping window border styles (WS_CAPTION | WS_THICKFRAME) and adjusting the position.
Notes¶
- Windows Only: Relies on PowerShell and Win32 API.
- Fullscreen Effect: This is “pseudo-fullscreen” achieved by stripping borders. The visual effect is equivalent to
BrowserWindow.setFullScreen(true), with no system title bar. - Environment Variable Correction: The plugin detects the absolute path of PowerShell (e.g.,
System32\WindowsPowerShell\v1.0, PowerShell 7, etc.) and corrects environment variables such as PATH and SystemRoot before spawning the child process, so it is not strictly required for them to appear in the system PATH. - Local Installation Errors: If installed via a local path, reinstallation may fail due to residual Junction links. You need to use
cmd /c rmdirto delete the residual link and then reinstall.
Conclusion¶
This plugin provides standardized window startup control capabilities for the DSH desktop client.