Introduction¶
When the DeepSeek Harness (DSH) desktop app launches, the window’s default size is hardcoded to 1280×820 in the Electron main process’s createWindow(), with no state persisted. After repeated use, the window reverts to its initial position and size, requiring manual adjustment—a recurring nuisance for developers who prefer a fixed layout.
The DSH plugin runs in an independent host process and cannot directly manipulate BrowserWindow. Instead, the plugin leverages the DSH Web service’s injection endpoint webserver/index-inject to insert a script at page load time, using window.moveTo() and window.resizeTo() to restore the last recorded window rectangle.
Plugin Overview¶
This is a DeepSeek Harness client plugin maintained by kvker, designed to remember the desktop app window’s last position and size, and automatically restore it on the next launch. It relies on no Electron APIs and uses only the browser-native window interface, so it only takes effect for the desktop shell (dsh-app://) origin. When the Web UI is opened in a regular browser, the plugin silently skips.
Core Behavior¶
- On startup, reads the last saved rectangle and executes
resizeTo(width, height)andmoveTo(x, y); - Afterwards, every second (and on page hide/unload), writes the current rectangle to
localStorage; - When maximized or in fullscreen, restoration uses the last recorded normal size and does not overwrite it;
- In a single-display environment, clamps the rectangle to the current screen’s available area to prevent the window from appearing off-screen;
- Only active in the desktop shell; skipped when the Web UI is opened in a browser.
Installation & Activation¶
You need to have the DeepSeek Harness desktop app installed (which ships with the dsh CLI). Install from npm:
dsh plugin --profile desktop add dsh-window-state-plugin
Or install directly from the GitHub source (using the latest commit):
dsh plugin --profile desktop add github:kvker/dsh-window-state-plugin
The plugin declares dsh.bundle.patch; the CLI appends it as a bundle layer to the profile and enables it. After installation, you must restart DSH— injection lines are only collected at startup.
To uninstall:
dsh plugin --profile desktop remove dsh-window-state-plugin
Configuration¶
Override with the same id (window-state) in ~/.dsh/profiles/desktop/cordis.patch.yml:
- id: window-state
config:
storageKey: 'dsh-window-state:v1'
minWidth: 520
minHeight: 600
saveIntervalMs: 1000
restoreDelayMs: 400
| Field | Default | Description |
|---|---|---|
enabled |
true |
Master switch. |
storageKey |
dsh-window-state:v1 |
Key in localStorage used to store the rectangle. |
minWidth / minHeight |
520 / 600 |
Minimum dimensions, consistent with the Electron main process. |
saveIntervalMs |
1000 |
Polling interval for saving. |
restoreDelayMs |
400 |
Delay before an additional restore pass after the window is shown. |
stateDir |
~/.dsh/window-state-plugin |
Directory for diagnostic files. |
Usage¶
- Restart DSH, drag the window to your desired position, and resize it to your preferred dimensions;
- Exit DSH normally;
- Next time you open it, the window will return to the last position and size.
On the very first launch there is no saved state, so the default position is kept; subsequent launches will remember.
Troubleshooting & Limitations¶
Troubleshooting:
~/.dsh/window-state/loaded.json: plugin load marker; its presence indicates the plugin is attached;- The saved rectangle is in
~/Library/Application Support/@deepseek-ai/dsh-desktop/Local Storage/leveldb, with the default keydsh-window-state:v1; - After modifying code or configuration, you must restart DSH for changes to take effect (injection lines are only collected at startup).
Limitations:
- Only effective in the desktop app; the Web UI opened in a browser cannot move/resize its tab window;
- Maximized or fullscreen states are not remembered; restoration uses the last normal size;
- In a multi-display environment, when
screen.isExtended === true, coordinates are not clamped; after a display is unplugged, the OS may pull the window back to the primary screen; - State is stored in
localStorage(origindsh-app://app); clearing site data for the app will lose it.
Development¶
The plugin is developed with Node.js >=22 and depends on @deepseek-ai/cordis >=4.0.5 <5. Run tests:
node --test test/
lib/script.js: generates the injection script (pure browser APIs, unit-testable);lib/index.js: Cordis plugin that pushes ascriptline towebserver/index-inject.
Use Cases & Notes¶
Suitable for DSH users who need a fixed window layout and frequently adjust window position and size. The plugin runs with the current dsh process privileges; review the source code and license before installing. This is a community-maintained project with no official affiliation with DeepSeek or High-Flyer.
Summary¶
This plugin achieves cross-launch persistence of window position and size using browser-native window APIs, eliminating the need for manual adjustments. For full details and source code, see:
- Catalog page: https://www.skillhub.cn/plugins/kvker/dsh-window-state-plugin
- GitHub: https://github.com/kvker/dsh-window-state-plugin