- Startseite
- Plugins
- UI-Erweiterungen
- dsh-handy-toolkits
dsh-handy-toolkits
kuoxinxin/dsh-handy-toolkits
Three GUI toolkits in one bundle: whole-page zoom (Cmd/Ctrl + Shift + =, - and 0, with a coordinate shim so anchored menus stay on their buttons), copy-on-select in the chat transcript (copies the dragged text and tells you how many characters, with an execCommand fallback), and Mermaid fences in replies drawn as diagrams with a full-screen viewer (wheel zoom anchored at the pointer, drag to pan) and PNG, SVG or source copy. The Mermaid engine ships inside the bundle, so nothing is fetched at runtime.
Installation
dsh plugin --profile web add github:kuoxinxin/dsh-handy-toolkitsREADME
dsh-handy-toolkits
A DeepSeek Harness plugin package. It ships three toolkits:
- Whole-page zoom — the desktop window has no page zoom of its own (its
Cmd/Ctrl+/-chords step font sizes), so this toolkit scales the document root and remembers the level. - Copy on select — dragging over a reply in the chat puts the text on the system clipboard immediately, with a short confirmation.
- Mermaid diagrams — a
```mermaidfence in a reply is drawn as the diagram instead of a wall of highlighted text. The engine ships inside the plugin, so nothing is fetched at runtime.
Whole-page zoom
| Chord (macOS) | Chord (Windows/Linux) | Effect |
|---|---|---|
Cmd + Shift + = | Ctrl + Shift + = | Zoom in 10% |
Cmd + Shift + - | Ctrl + Shift + - | Zoom out 10% |
Cmd + Shift + 0 | Ctrl + Shift + 0 | Reset to 100% |
- Range 50%–200%, 10% per press; a small readout shows the new level.
- The level persists in
localStorage(dsh-handy-toolkits:level) and is restored on the next boot. 100% is never stored. - Shift is required on purpose: without it the chords belong to the built-in font-size commands, and hijacking them would break text sizing.
- Disabling the plugin restores 100% and detaches its listeners.
Copy on select
Drag across a reply, a code block, or a whole turn: when the pointer is
released the selected text is already in the system clipboard. A readout in the
corner confirms the copy (已复制 N 个字符 / Copied N characters) and says so
when the clipboard is not reachable.
- Scope is the transcript only:
[data-conversation-scroll](the message scrollport) and[data-chat-turn](message rows). Selections in the composer, the sidebar, and the settings pages keep their native behaviour, and the composer's rich-text editor owns its selection outright. - Empty selections and accidental
Cmd/Ctrl + Aselections (over 200 000 characters) are ignored, so nothing huge is silently written to the clipboard. - Text is written with
navigator.clipboard.writeText; when that is unavailable (or denied) it falls back todocument.execCommand("copy")on the live selection, then on a scratch node. Cmd/Ctrl + Cstill works as before — this only removes the second step.
Mermaid diagrams
A fence tagged mermaid renders as the diagram itself:
```mermaid
graph TD
A[Start] --> B{Ready?}
B -->|yes| C[Done]
B -->|no| A
```
- Any diagram mermaid supports works (flowchart, sequence, class, state, ER, gantt, pie, mindmap, timeline …), in the chat transcript and in the history of reloaded sessions.
- The source stays available: an unparseable fence keeps its code block and adds
one line with the reason (
Mermaid: Parse error on line 2), and a fence that has not finished streaming is left as code until the turn ends. - The diagram follows the app theme — switching light/dark redraws it — and it scales with the whole-page zoom like any other content.
- Mermaid runs with
securityLevel: "strict", so HTML inside labels is not evaluated. Labels are still text from the model: treat a diagram as untrusted content, like any other reply. - The engine (mermaid 11.17.2,
dist/mermaid.min.js) is gzipped and stored inlib/client.js; the app downloads it once with the bundle (~1 MB over the wire, cached immutably per revision) and the browser only inflates and runs it when the firstmermaidfence appears.
Viewing and copying
Hover a diagram (or tab onto it) and two actions appear in its corner:
- Copy (the clipboard icon with a caret) —
PNG,SVG, or the mermaid source. PNG and SVG are written to the clipboard as images, so a paste into a document, a chat, or a slide deck lands as a picture; the source is copied in a fenced block so it can be edited again. A readout confirms which format went out (已复制 PNG/Copied PNG), and says why when the browser refuses the clipboard. - Full screen (the expanding-corners icon) — opens the diagram in a viewer
over the app:
+/−step the scale, the percentage button returns to 100%, the inward-corners icon fits the window, the wheel zooms around the pointer, dragging pans, a double-click toggles fit and 100%, andEsc(or a click beside the diagram) closes it.
Every control is an icon with the same words in its tooltip and accessible name, so nothing depends on hover text being read.
Details worth knowing:
- 100% means one diagram pixel per app pixel at the current page zoom. With
the page at 150% a 100% viewer shows the diagram at the size the transcript
draws it. The viewer is a real overlay, not a zoomed copy, so it follows the
page-zoom chords while it is open: the window resizes and the diagram is
re-centred at the same scale. Keys with a platform modifier always belong to
the app, so
Cmd/Ctrl + Shift + =still zooms the page while the viewer is up; plain+/-/0scale the diagram. - The scale runs from 25% to 800%. Opening a small diagram never enlarges it past 100%, so "full screen" on a two-node graph does not fill the monitor with two giant boxes.
- A copy uses the diagram as it looked when the overlay opened — the theme is captured at open time, so toggling light/dark in the app does not change the image you are about to paste. Close and reopen to pick up a new theme.
- PNG is rasterised at 2× and needs the labels drawn as SVG text, so the copy
re-renders the same source once with
htmlLabels: false: the SVG shown in the transcript uses<foreignObject>labels, which a canvas silently drops. The background is filled with the theme colour so a dark diagram stays readable on a light page. - Copying needs a focused window; if the browser rejects the clipboard the readout says so and the diagram itself is untouched.
Install
Quit DeepSeek Harness completely (Cmd + Q), then:
./install.sh # desktop profile
./install.sh web # another profile name
The script copies the package to ~/.dsh/profiles/<profile>/plugins/dsh-handy-toolkits
and appends one Loader entry to ~/.dsh/profiles/<profile>/cordis.patch.yml:
- insert:
- id: dsh-handy-toolkits
name: "./plugins/dsh-handy-toolkits/lib/index.js"
A patch entry can only edit an existing row, so the entry is added through a
patch's insert list rather than as a bare row.
Then reopen DeepSeek Harness. No package manager, dependency, or build step is
involved: the browser bundle at lib/client.js is already in the
window.__ModuleLoader__.load({ id, factory }) form the client module host
serves.
Manual install
profile=~/.dsh/profiles/desktop
mkdir -p "$profile/plugins"
cp -R dsh-handy-toolkits "$profile/plugins/dsh-handy-toolkits"
printf '%s\n' '- insert:' ' - id: dsh-handy-toolkits' ' name: "./plugins/dsh-handy-toolkits/lib/index.js"' >> "$profile/cordis.patch.yml"
Uninstall
./uninstall.sh # desktop profile
./uninstall.sh web
Removes the Loader entry (leaving a .bak copy of the patch file) and deletes
the plugin directory. Quit the app first.
From npm
The package is published as dsh-handy-toolkits
(dsh.bundle.patch → cordis.patch.yml), so it installs without cloning the repo:
- Plugins → Add plugin →
dsh-handy-toolkits— the GUI registers the package as a profile bundle, so it is loaded on the next start. - CLI —
dsh plugin --profile desktop add dsh-handy-toolkits(quit the app first).dsh pluginforwards its arguments to pnpm inside the profile, so it installs the files but does not add the package todsh.profile.bundles; add the name there yourself, or the plugin will be installed without ever loading.
A tagged release also carries the same tarball at
https://github.com/kuoxinxin/dsh-handy-toolkits/releases/latest/download/dsh-handy-toolkits.tgz,
which the market entry points at so installs do not depend on the npm registry.
Publish
See PUBLISH.md for the full checklist: manifest requirements
(dsh.bundle.patch, dsh.client, engines.dsh), npm publish, how to test the
install without publishing, and how to get listed in a plugin market (format-1
index for the Discover page, or a PR to awesome-dsh-plugin).
Test
npm test # node --test: chords, persistence, clamping, coordinate shim, copy, scope, fence layer, teardown
Refresh the vendored engine after a mermaid release:
node scripts/vendor-mermaid.mjs # 11.17.2, the pinned version
node scripts/vendor-mermaid.mjs 11.18.0 # another version from npm
node scripts/vendor-mermaid.mjs ./mermaid.min.js
Verify
- Reopen the app and look at 设置 → 插件: a row
dsh-handy-toolkitsshould be enabled. - Press
Cmd/Ctrl + Shift + =twice: the page (sidebar, transcript, buttons) grows, and the readout saysPage zoom 120%. - Quit and reopen: the level is still 120%.
- At 150%, open a menu (the sidebar
More, a model picker): it opens flush to its trigger (dx/gap of a few px), and near the window edge it flips inside instead of hanging off screen. - Drag across a reply in the transcript: a
已复制/Copiedreadout appears andCmd/Ctrl + Velsewhere pastes that text. - Ask the agent for a mermaid diagram, or paste one as a reply: the fence turns into a drawn diagram, and switching the app between light and dark redraws it in the new palette.
Screenshots from that check (headless Chromium, real GUI, 1440×900): docs/zoom-100.png,
docs/zoom-150.png, docs/zoom-200.png.
How it works
lib/index.js— host half, an emptyapply(); it exists so the Loader has an enabled row.lib/client.js— browser half, three toolkits sharing one bundle and one readout node. The zoom toolkit restores the stored level, setsdocument.documentElement.style.zoom, and installs a capturingkeydownlistener; the copy toolkit installs a capturingpointeruplistener ondocumentand readswindow.getSelection()synchronously, while the pointer gesture still counts as user activation for the clipboard write.event.code(physical key) keeps the chords layout-independent, andpreventDefault+stopImmediatePropagationkeep them from reaching other handlers.- CSS
zoomon the root scales layout, text, and hit-testing together in Chromium, so pointer coordinates stay correct — unlike atransform: scale(). Fixed-position surfaces scale with the root instead of detaching from it. - Coordinate shim. Painting is scaled, but the JavaScript coordinate space is
not:
getBoundingClientRect(),innerWidth/innerHeightandvisualViewportkeep reporting visual (zoomed) pixels, whilestyle.left/topandevent.clientXstay in layout pixels. The GUI positions menus and popovers withgetBoundingClientRect()and writes those numbers toleft/top, so a barezoompushes every anchored surfacelevel ×away from its trigger (a menu 250 px below its button at 150%), and edge clamping measured against the visual viewport lets menus hang off the window. While a level other than 100% is active the toolkit divides the visual APIs by the level —Element.prototype.getBoundingClientRect, the root'sclientWidth/clientHeight,innerWidth/innerHeight,visualViewport.width/height— so the app measures and places in one space, the same one native page zoom exposes. Every patch is undone at 100% and on teardown. - Mermaid fence layer. The chat asks
conversation.chat.markdown.fencefor a component around every code fence, keyed on the fence language; the plugin registers one layer withkey: "mermaid"throughctx.slots.inject. The layer getslang,code,streamingand the plain code block aschildren: it renderschildrenwhile streaming or when the engine rejects the diagram, and otherwise adivwhosedangerouslySetInnerHTMLholds the engine's SVG. One engine load is shared by every diagram on the page; aMutationObserveronbody[data-ds-dark-theme]starts a redraw fromcomponentDidUpdate, because React batchessetState— drawing inside the theme callback would still read the theme that was just replaced.
Troubleshooting
- Chords do nothing — the plugin is not enabled, or the bundle is missing: check 设置 → 插件 for a load error, then quit and reopen the app.
Page zoomreadout appears but nothing grows — another plugin sets azoomon the root element; only one can own it.- A menu lands far from its button — this is the pre-0.2.1 bug: CSS
zoomwas applied without the coordinate shim, so the app placed the menu with visual pixels but in a layout-pixel slot. Upgrade to 0.2.1 (or reset to 100% and zoom again so the shim installs). - Text looks blurry — CSS
zoomre-rasterizes text, but fractional levels (110%, 130%) can look softer than 100% or 150%. Use the reset chord to return to a crisp 100%. - Selection copies nothing — the selection has to start inside the
transcript (
[data-conversation-scroll]/[data-chat-turn]). Selecting in the composer or the sidebar never copies. If a future UI drops those attributes the toolkit stays quiet instead of guessing at a scope. Copy failedreadout — the clipboard API was rejected (window not focused, permission denied).Cmd/Ctrl + Cstill works; focus the window and the next drag copies again.- The entry is red in 设置 → 插件 — verify the path: the Loader resolves
./plugins/...against the profile directory, so the file must be at~/.dsh/profiles/desktop/plugins/dsh-handy-toolkits/lib/index.js(a directory or a bareindex.jswill not resolve). - A
mermaidfence stays a code block — the turn is still streaming (the diagram appears when it ends), the diagram has a syntax error (one line names the reason under the code block), or the layer never mounted (check 设置 → 插件 for a load error). A very heavy diagram can also fail on the engine side; the message is shown verbatim. - The diagram is bigger/smaller than the text around it — mermaid sizes
labels with its own font stack; the layer passes
fontFamily: "inherit"so the SVG follows the app's font settings, and the whole diagram scales with page zoom like any other content. - Content runs off the right edge — this is real zoom, not a smaller layout viewport: at 200% on a narrow window the UI legitimately needs more room. Zoom out, widen the window, or hide the sidebar.
- No Copy / Full screen buttons on a diagram — the two icon buttons appear on hover or keyboard focus; if they never show, the layer is the older 0.3.0 build (check the version in 设置 → 插件) or the SVG fell back to a code block because the diagram failed to parse.
Copy failed: Document is not focused— the window lost focus (another app, a headless session). Click the app window and copy again. The same message appears for any clipboard rejection, including a denied permission.- A pasted PNG has no labels — the raster path re-renders with
htmlLabels: false; if labels are still missing the diagram probably draws text via a foreign object the engine cannot flatten (somemindmaplayouts). Copy SVG instead — it keeps the text as real text. - The full-screen viewer is offset to one side under page zoom — the viewer
measures the window in layout pixels and never calls
getBoundingClientRect, so this means it was built without the coordinate shim (page zoom below 0.2.1) or another plugin resized the root. Reset page zoom to 100% and reopen the viewer.
Ähnliche Plugins
dsh-web (dsh-task-board)
zhu1090093659/dsh-web
dsh-web (dsh-web-all)
zhu1090093659/dsh-web
dsh-TUI
ccch1mneyyy/dsh-tui
dsh-web-ui (dsh-task-board)
zhu1090093659/dsh-web-ui