Remembers the macOS DSH desktop window size, and re-applies its main-process patch after an app upgrade from a switch in settings.
Install
# from a prebuilt release tarball
dsh plugin --profile web add -w "https://github.com/wphhyan/dsh-window-keeper-mac/releases/download/v0.6.1/dsh-window-keeper-mac-0.6.1.tgz"
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:wphhyan/dsh-window-keeper-mac
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
简体中文 | English
Remember the DeepSeek Harness desktop window size on macOS: it restores the geometry you left behind on the next launch, and after a DSH upgrade replaces the app bundle, one switch in settings re-applies the support patch.
The problem
The DSH desktop shell creates its main window with a hard-coded geometry and never records it, so every launch snaps back to 1280×820. Electron only lets the main process create and resize that window, and a DSH plugin runs in the desktop host child process — it cannot reach a BrowserWindow. On macOS an external helper cannot resize another application's window without the Accessibility permission, which most users have not granted and which cannot be requested reliably from a plugin.
So this plugin does the only thing that works without system permissions: it keeps a small, version-independent patch in the shell's lib/main.js that records the window geometry on close/quit and applies it before the window is created, and it owns everything around that patch — detecting when a DSH upgrade silently removed it, re-applying it, verifying the result, and keeping a pristine backup.
What it does
- Restore: on every launch, the saved normal bounds and maximized flag are applied before the window is created, so there is no "small window first, then jumps" flash. Saves are debounced on move/resize/maximize, and captured immediately on close and quit.
- Detect: after a DSH upgrade replaces
app.asar, the settings status line says the patch is gone (and from which version it disappeared). - Re-apply: turn on
reapplyNowin Settings → Plugins → Window memory. The patch is rebuilt from the livelib/main.js, verified, installed, and the status says a restart is needed. - Verify: the rebuilt archive is read back with Electron's own asar reader (not the plugin's parser), and after the rename its SHA-256 is compared with the staged file.
- Revert:
revertNow, or thewindow_keepertool withaction: "revert", restores the pristineapp.asarthis plugin saved. Restores are refused when the backup no longer matches the running version.
Install
From the plugin market entry, or from this repository:
dsh plugin --profile desktop add github:wphhyan/dsh-window-keeper-mac
The desktop app also accepts a local directory through Settings → Plugins → Add plugin.
Settings
Settings → Plugins → Window memory (a tab of its own, plus the automatic config form):
| Field | Meaning |
|---|---|
reapplyNow |
Re-enable switch. Applies the patch immediately; resets itself afterwards and writes the outcome to status. |
revertNow |
Restore switch. Restores the saved pristine app.asar; resets itself. |
autoReapply |
Off by default. When on, a launch that finds the patch missing re-applies it automatically (a restart is still needed). |
status / details |
Read-only outcome line and geometry summary (saved bounds, last restore, backup). |
appPath |
Bundle path; empty means autodetect from the running executable. |
The window_keeper tool offers the same operations to the agent: status, apply, revert.
Safety and what it changes
It writes only
Contents/Resources/app.asar, and only when you turn a switch on, or whenautoReapplyis on and the patch is missing.Only the bundle this app currently runs from can be patched: an
appPathpointing at another Electron app is refused, so the plugin cannot modify a different installation.Before the first install it copies the current archive to
app.asar.window-keeper.bak. A backup from another version is never used to overwrite a newer build.The write goes to a sibling staging archive, is verified, and is then renamed into place atomically. A crash leaves at most a stray staging file.
Verified on install:
node --checksyntax, exactly one patch region, every other archive entry byte-identical, payload base unchanged, Electron's reader opens the staged archive, and the post-rename SHA-256 matches.Rollback at any time:
cp "/Applications/DeepSeek Harness.app/Contents/Resources/app.asar.window-keeper.bak" \ "/Applications/DeepSeek Harness.app/Contents/Resources/app.asar"
Limitations
- macOS only. On other platforms the plugin reports
not-foundand does nothing. - Modifying
app.asarinvalidates the application's code signature. The app still launches on macOS, but macOS may show a signature warning, and DSH's own updater may refuse or re-sign the bundle on the next update — that update also removes the patch, which is what the re-enable switch is for. This plugin does not callcodesign. - Requires write permission on
/Applications/DeepSeek Harness.app. A per-machine install owned by the user works; a root-owned installation needs an administrative action the plugin does not perform. - If a future DSH release turns on Electron's embedded asar integrity validation, a patched bundle will not start. Check the status before enabling the switch after an upgrade; the plugin refuses to install an archive Electron cannot read, but it cannot change the shell's own integrity policy.
- Uninstalling the plugin does not remove the patch. Revert first, then uninstall.
- The patch only records the primary window; the welcome window, update dialog, and embedded platform views are not tracked.
- A crash or
kill -9can lose at most the last 400 ms of window adjustments.
Why not a helper process?
Windows plugins in this space watch and resize the window from a small helper process. macOS does not allow that without Accessibility permission, so the main-process patch is the only route that needs no special permission. The trade-off: a DSH upgrade replaces the file, hence the re-enable switch instead of a background service.
See docs/UPSTREAM-IPC.md for the desktop API this plugin would use if the shell ever exposes window geometry to plugins — then the patch would no longer be needed.
Tests
npm test
Four checks on synthetic archives: deterministic patch output, byte-identical revert, refusal without the expected anchors, and refusal when a patch is already present. Running ELECTRON_RUN_AS_NODE=1 <electron> test/patch.test.mjs additionally exercises Electron's own asar reader.
Requirements
DSH Desktop for macOS, 0.2.2-rc.1 or newer (engines.dsh). Node 22+ is only needed for local development.
License
MIT
Links
More in this category
zhu1090093659/dsh-web#packages/dsh-task-board★ 10645
Task board for the dsh web GUI: a sidebar multi-column kanban whose cards run in real DSH agent sessions and can also be scheduled with cron expressions, executed host-side even with the browser closed.
zhu1090093659/dsh-web#packages/dsh-web-all★ 10645
Plugin and skin collection for the DSH Web UI: task board, Git graph, right-side panel, remote mobile UI, pet, live token stats, and a skin center.
ccch1mneyyy/dsh-TUI★ 8283
Claude Code-style full-screen terminal UI: pixel-whale header, live status line, and streaming thought expansion.
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 7472
A fixed-corner whale widget for the DSH web GUI — balance, today's usage and per-turn cost with peak/off-peak pricing, editable balance-alert and daily-budget bubbles, a module-based custom bubble queue with A/B weighted choices and random lines or images, 30+ vendor templates (OpenAI, OpenRouter, Kimi, SiliconFlow, Ark, Zhipu, MiniMax and more) with per-model balance and subscription quota, plus task-end sound, imported audio, custom roles and a resource manager. Local-only, no telemetry.
omdsh-dev/DSH-better-sidebar★ 5336
Full sidebar workbench with file rendering and editing, terminal, Git, and subagents; third-party plugins can register new tabs.
omdsh-dev/dsh-genui★ 1060
Interactive UI components rendered inline in replies: layout, charts, forms, quizzes, mermaid, 3D scenes, and an action event loop back to the model.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.