Maximizes the DeepSeek Harness desktop window automatically on startup, equivalent to clicking the maximize button once. Cross-platform (Windows/macOS/Linux), best-effort, host-only.
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-auto-maximize
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:FideFeiPlane/dsh-auto-maximize
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
DeepSeek Harness desktop plugin: automatically maximizes the main window on startup (equivalent to clicking the maximize button once).
Works with the DSH desktop app (desktop profile) and any scenario where DSH runs inside an Electron/system window.
How it works & platform support
The plugin is host-only: it loads in the host process at app startup. The host is a Node child process
(ELECTRON_RUN_AS_NODE=1, spawned by the Electron main process that owns the window), so it can never
call BrowserWindow.maximize() — instead it uses per-platform OS-level maximize. Everything is
best-effort: on failure it logs a warning and never crashes the host:
| Platform | Strategy | Dependency | Notes |
|---|---|---|---|
| Windows | ① In-process FFI: call Win32 ShowWindow(hwnd, SW_MAXIMIZE) from the host's own process via the koffi that ships with DSH② Fallback: pwsh 7 → Windows PowerShell 5.1 child process |
① none (koffi ships with DSH)② pwsh 7, falls back to 5.1 (always present on Windows) | ① no subprocess, measured 60–210 ms (about 60 ms when the window is already maximized; a real transition includes one 200 ms verification wait); falls back to ② when koffi is unavailable. PowerShell is resolved via PATH, no hardcoded install path |
| macOS | Resize the window to the main screen's visible frame (NSScreen.visibleFrame — i.e. "send the window a maximize instruction"); if that fails, click the green AXZoomButton as a remedy |
osascript (built-in) |
Requires Accessibility permission for the caller; a grant guide is logged when missing. Override the app name with processName. |
| Linux | wmctrl → xdotool set _NET_WM_STATE_MAXIMIZED |
usually not preinstalled | Best-effort; skips silently if both are missing. |
Window lookup (Windows): resolve each window's owning process image path with
QueryFullProcessImageNameW and accept only windows owned by the same executable as the host; among
several, prefer pid == host parent (the Electron main process), then the largest area (the main
window, not the welcome window). Only windows with WS_MAXIMIZEBOX qualify. If FFI finds nothing, the
PowerShell fallback still locates by "host parent PID + executable path".
Why not BrowserWindow.maximize(): the host process is plain Node (ELECTRON_RUN_AS_NODE=1,
require('electron') throws MODULE_NOT_FOUND), so plugins can only reach OS-level window handles.
"Auto maximize" is implemented as "equivalent to the user clicking the maximize button once" via
system calls, not an Electron API call.
Where the FFI dependency comes from: koffi is a runtime dependency already shipped with the
DSH desktop app (@deepseek-ai/dsh-desktop-host's dependencies; the native binary lives in
app.asar.unpacked, and desktop-host's own cli.js uses it to install the Ctrl-C handler). The
plugin only borrows the copy inside the DSH installation, so the package stays free of third-party
runtime dependencies.
Install
Option 1: from the plugin market / npm (once published)
dsh plugin --profile desktop add dsh-auto-maximize
Option 2: local project install (development)
In your profile directory (e.g. ~/.dsh/profiles/desktop):
// package.json
{
"dependencies": { "dsh-auto-maximize": "file:./plugins/dsh-auto-maximize" },
"dsh": { "profile": { "bundles": [ /* append */ "dsh-auto-maximize" ] } }
}
Then pnpm install and restart the DeepSeek Harness desktop app.
Configuration
Override the auto-maximize row in the profile's cordis.patch.yml:
- id: auto-maximize
config:
enabled: false # disable
engine: auto # Windows strategy: auto | ffi | powershell (default auto)
timeoutMs: 5000 # how long to keep looking for the window (ms, default 5000)
processName: 'DeepSeek Harness' # process name used to locate the window on macOS/Linux
logKeepRuns: 5 # keep the last N startups in the log (default 5)
logKeepLines: 200 # max lines per run block (default 200)
Options:
| Config | Type | Default | Description |
|---|---|---|---|
enabled |
boolean | true |
false disables the plugin entirely |
engine |
'auto' | 'ffi' | 'powershell' |
'auto' |
Windows strategy: auto = in-process FFI first, PowerShell on failure; ffi / powershell force one (for diagnosis) |
timeoutMs |
number | 5000 |
max time to keep looking for the window (ms). It normally appears within 1s of launch, so 5s without one means something is wrong; under engine: auto FFI and PowerShell time out independently, so the worst case is about 2× |
processName |
string | executable basename | process/window name to match on macOS/Linux |
logFile |
boolean | string | ~/.dsh/auto-maximize.log |
diagnostic log: false disables file logging; a string relocates it; delete the file to clear it |
logKeepRuns |
number | 5 |
how many recent runs to keep in the log file (one ===== … ===== block per startup) |
logKeepLines |
number | 200 |
max lines per run block (overflow drops the middle, keeping the header and the most recent tail; the current block stops once full) |
macOS: Accessibility permission required
On macOS, controlling another app's windows via osascript (System Events) requires
Accessibility permission. When it is missing the plugin logs a guide (keyword
dsh-auto-maximize). Grant it like this, then restart:
- Open System Settings → Privacy & Security → Accessibility.
- Enable DeepSeek Harness (and the terminal/launcher that hosts it, if any).
- Restart DeepSeek Harness (the grant does not affect already-running processes).
⚠️ Note: the "instruction form" also needs the permission. Whether the plugin resizes the window directly (
set position/size— "send the window a maximize instruction") or clicksAXZoomButton, both go through the same macOS Accessibility API and both need the Accessibility grant. Why: the only way to move another process's window is that API — the system's gate is on the API itself, not on process identity. Even thoughosascriptis DSH's own child process, TCC attributes the grant to the DSH app (so enabling DeepSeek Harness covers it), but it does not waive the grant. The Windows-style in-process FFI does not bypass it either: macOS has no cross-process "post a message and the window maximizes" call, so zoom can only go through the Accessibility API — exactly the entry the grant gates. The only permission-free route is DSH maximizing its own window inside its own process (a startup flag / host→main IPC callingBrowserWindow.maximize()) — that needs a DSH-provided channel, which an external plugin cannot offer. Keep the grant.
If it still does not work, set processName to the real process name — a packaged app's
display name can differ from its executable's basename.
Diagnostic log: every step is written to ~/.dsh/auto-maximize.log
(Windows: %USERPROFILE%\.dsh\auto-maximize.log). One file only, newest run on top: each block
starts with ===== <time> run(pid=…, version=…) ===== followed by that startup's lines; the last
logKeepRuns runs are kept (default 5), and each block is capped at logKeepLines lines (default
200 — the middle is dropped, the header and the most recent tail are kept). Blocks are ordered by the
timestamp in their header, so a hand-edited file is re-ordered correctly; a block whose header cannot
be parsed (corrupted, garbage, legacy remnant) counts as oldest and is evicted on the next startup.
When maximize "doesn't work", open this file: on Windows you will see ffi: koffi … via … /
ffi: maximized hwnd=… / koffi unavailable, on macOS the osascript result — perm: (missing
permission) / nowindow: (window not found) / maximized-bounds (success). Disable it with
logFile: false, or delete the file to clear it.
By contrast, Windows needs no extra permission:
ShowWindow(hwnd, SW_MAXIMIZE)is a direct Win32 API call (not simulated clicks) and needs no elevation for the user's own window.Why macOS has no equivalent in-process path: on Windows, maximizing is a message sent to a window, so any process may call it for any
hwnd. On macOS, zoom is an operation of the window object itself (NSWindow), and cross-process access is only possible through the Accessibility API (AXUIElement+kAXZoomAction) — which itself requires Accessibility permission. So on macOS the only route is "system API + permission": in-process FFI would neither remove the permission nor add capability, which is why this plugin still usesosascriptthere.
Uninstall
Remove dsh-auto-maximize from both places in the profile's package.json
(dependencies + dsh.profile.bundles), run pnpm install, restart the app.
Development
npm install # the package has no third-party runtime deps (FFI borrows DSH's own koffi); dev only needs node:test
npm test # 36 cases: module load / disabled branch / effect registration / koffi anchor
# fallback / window selection / engine order / log guard / verify-live script
npm pack # build the publishable tarball (prepack runs the tests first)
Tests and packaging run with DSH_AUTO_MAXIMIZE_NO_LOG=1, so they never write to or rotate your real
~/.dsh/auto-maximize.log.
Verifying without restarting DSH
The plugin runs once per mount: cordis calls apply(), which maximizes whatever window exists at
that moment. Re-mounting the bundle therefore re-runs it — toggle it off and on in Settings → Plugins,
no app restart needed. scripts/verify-live.ps1 checks exactly that way: it reads the newest mount
from the log and then confirms with Win32 that the window is really maximized.
Publishing to npm
npm login # first time
npm publish --registry https://registry.npmjs.org
Once published, submit the plugin for listing in dsh-market
via its "Submit a plugin ↗" link (a data/plugins/<owner>__<repo>.yml file in
awesome-dsh-plugin — see
contributing.md).
Known limitations
- Only meaningful in the desktop profile; a web profile has no window and the plugin skips silently.
- Runs once at startup; never touches window state you change during a session.
- macOS requires granting Accessibility permission to DeepSeek Harness first, otherwise only a
permission guide is logged; Linux needs
wmctrlorxdotoolinstalled. - Multi-instance/multi-window: on Windows it first claims this instance's window by image path,
then prefers
pid == host parent, so multiple DSH instances don't interfere; only when this image owns no window does it move to the next engine. macOS/Linux take the "frontmost / first match" window — useprocessNameto disambiguate when running several instances. - On failure only writes to the host log (keyword
dsh-auto-maximize); the app keeps running.
Roadmap (not implemented — PRs welcome)
- Settings UI toggle: wire
enabledinto "Settings → General". The plugin is host-only and currently readscordis.patch.ymlonly; a UI switch needs a client-plugin settings panel. - Startup flag / host↔main IPC: have DSH itself expose
--maximize, or allow window-control messages through the host→main IPC whitelist (currently onlyupdate-tasks/quit-inspection/ready/shutdown-complete/platform-session; anything else gets SIGTERM). That is an upstream change a plugin cannot make. See "Investigated: why not DSH's own channel" below. - Official icon:
assets/icon.svgis a placeholder maximize glyph — a real icon is welcome.
Investigated: why not DSH's own channel
- The Electron main process has no window switch: it reads only
process.argv.includes("--updated"), hardcodes a1280×820window, persists no window state, and its desktop settings file accepts onlyupdates.allowTestAuthPopupWindow. - Relaunching with flags does nothing:
requestSingleInstanceLock()'ssecond-instancehandler only focuses the window; the new arguments never reach the existing one. dshCLI flags cannot reach the window: booting the desktop profile from the CLI is refused (profile "desktop" is managed exclusively by the Electron application).
Repository: Gitee (primary) https://gitee.com/FideFei/dsh-auto-maximize | GitHub (mirror) https://github.com/FideFeiPlane/dsh-auto-maximize
License
MIT © FideFei
Links
More in this category
zhu1090093659/dsh-web#packages/dsh-task-board★ 10703
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★ 10703
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★ 8557
Claude Code-style full-screen terminal UI: pixel-whale header, live status line, and streaming thought expansion.
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 7523
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★ 5405
Full sidebar workbench with file rendering and editing, terminal, Git, and subagents; third-party plugins can register new tabs.
omdsh-dev/dsh-genui★ 1091
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.