- Home
- Plugins
- Vision, Voice & Multimodal
- dsh-quick-screenshot
dsh-quick-screenshot
fyb0603-bit/dsh-quick-screenshot
Screenshot control that floats over every DSH page, with a second one in the composer tool row: it captures the DSH window, the active window or the whole desktop through the host capture tooling and puts the PNG into the composer draft as an attachment, or on the clipboard when no composer is mounted. Shift-click opens a box-select crop that slices at native pixels. Windows adds region recording to mp4/gif via ffmpeg gdigrab, OCR on a captured PNG, always-on-top pinning, save and copy; macOS and Linux ship capture backends only.
Install
dsh plugin --profile web add github:fyb0603-bit/dsh-quick-screenshotREADME
dsh-quick-screenshot
English | 中文
仓库:https://github.com/fyb0603-bit/dsh-quick-screenshot · 许可:MIT
One-click screenshots of the DeepSeek Harness window, a chosen application window, the whole desktop, or a selected region — placed straight into the composer draft. DSH minimizes itself while another window or the desktop is captured, so its UI never blocks the shot.
It is one self-contained DSH bundle: a Host half that captures the DSH window (or
a window / the whole desktop) through the platform's own tooling and serves the
PNG over one authenticated Fetch route, and a hand-written Client half served as
the package's ./client bundle.
What it adds
| Seat | Result |
|---|---|
shell.overlay | A floating camera control over the whole window, so a screenshot works on every page — not only where a composer happens to be mounted. Drag it anywhere; the anchor persists in localStorage. |
conversation.input.left | The same control in the composer's left tool row, next to + |
| Gesture | Capture target |
|---|---|
| Click | Whatever defaultMode names — shipped as region, so the shot is taken and the crop overlay opens; set it to window to capture the DeepSeek Harness window directly |
| Shift+click | The whole desktop, every monitor; DSH is minimized for the shot, then a crop overlay opens |
| Crop actions | Drag to select, then use the bottom action bar (Use full image, Cancel, Add selection); it sits clear of the native titlebar and window controls |
| Alt+click | Whatever window is currently in the foreground |
Ctrl+Shift+S | The same as a plain click, from anywhere on the page |
▾ next to the camera (or right-click either camera) | Open the window picker and capture one chosen window |
The picker (GET /api/quick-screenshot?windows=1) lists title, process, size and
minimized state. DSH comes first, other windows follow their z-order, and
minimized windows come last; tool windows and tray palettes are filtered out.
Choosing a window captures that exact handle. If it closed after the list was
read, the Host answers WINDOW_GONE instead of silently capturing whatever is
in front. A minimized target is restored for the shot and minimized again
afterwards. The list also repositions on scroll, stays inside the viewport,
and supports ↑/↓, Home/End, Enter and Esc; clicking ▾ again closes
it instead of closing and reopening it. DPI-unaware legacy windows are printed
at their logical size and scaled back to physical pixels, so the shot does not
end with white bands on the right and bottom.
Where the image lands depends on what is on screen: a mounted composer's draft
takes it as an attachment, so the next message carries the image; with no
composer mounted the PNG goes to the clipboard, ready to paste into the
conversation the reader navigates to. No annotation step interrupts this. A click never steals the keyboard —
mousedown is prevented, so the caret stays where it was.
The control reports what happened in place: a spinner while the Host captures,
已放入输入框 with the captured pixel size for a few seconds afterwards, or the
Host's own refusal text when the capture failed. The tooltip carries the full
gesture list and the last result.
Capture goes straight into the composer
A capture is finished the moment the pixels exist: region, window and desktop shots all land in the composer draft as an attachment, so the next message carries the image. No editor opens — the default path has no extra clicks. With no composer mounted, the PNG goes to the clipboard instead.
Annotation is a manual detour: enlarge any image in the conversation and the
preview grows an Annotate button in its bottom-right corner. The toolbar has
no ✎ any more.
Annotation editor (from the image preview)
The entry point is the conversation image lightbox: press Annotate and the previewed pixels become the editing surface. Done puts the result in the composer draft (clipboard when no composer is mounted).
Three jobs only: crop, freehand, arrow.
| Tool | Key | Behaviour |
|---|---|---|
| Select | 1 | Move/resize the region, draw nothing (the default tool) |
| Arrow | 2 | Solid triangular head that scales with length |
| Pen | 3 | Free polyline; a single point becomes a dot |
Drag a region and refine it with eight handles (four corners, four edges); on
release, autoSnapToWindow snaps it to a window edge. A drag shorter than 6px
counts as no region, and Esc clears the region first and closes on the second
press. The exact pixel size is reported while dragging.
The stroke colour is fixed red #FF3B30 and the width is fixed 4px — there is no
swatch row and no width picker. Ctrl+Z / Ctrl+Shift+Z (or Ctrl+Y) undo and
redo, Ctrl+C copies the composite.
Clicking the tool that is already active turns drawing off and goes back to Select; the same button re-arms it, so there is no need to reach for another control.
Every button sits in one bottom bar: Arrow / Pen / Undo / Redo on the
left, Cancel / Copy / Done on the right. The top bar keeps only the title
and the pixel size.
Done (Enter) puts the composite into the composer draft, or onto the
clipboard when no composer is mounted.
Recording
● next to the camera (or the screenshot.record command) opens a region picker.
The chosen rectangle is recorded by ffmpeg through gdigrab into a fragmented
mp4, then remuxed on stop (-c copy -movflags +faststart) into a normal mp4;
choosing gif encodes at 10fps with -loop 0. A floating control shows mm:ss,
stopping copies the path, and Esc cancels and removes the partial file.
Rectangles are sent in virtual-screen coordinates, so negative multi-monitor
offsets work. Frames default to 10fps, and durationMs > 0 stops on its own.
Pin
Pin turns the composite into an always-on-top WinForms window in its own PowerShell
process: drag to move, wheel to scale between 0.2x and 8x, double-click to copy and
close, right-click for opacity and close. The window title is DSH-PIN-<pid> and the
Host enumerates by that prefix, so unpin with an id closes one and 0 closes all.
The screenshot.pinLast command pins the most recent capture directly.
OCR
OCR uses the built-in Windows.Media.Ocr, trying the user's languages first and
then zh-CN and en-US. It returns the text plus per-line results, and the client
puts the whole block on the clipboard and reports how many lines came back. This
machine only has the zh-CN OCR language pack installed, so other languages need
their pack added in Windows first.
Settings page
Open the DSH settings dialog and pick Screenshot settings in the left rail
(slot settings.section, id screenshot, order 40). The form reads
GET /api/quick-screenshot?settings=1 and saves through
POST {action:"settings"} into ~/.dsh/plugins/dsh-quick-screenshot/settings.json
(temp file plus rename, unknown keys dropped); the button briefly reads Settings
saved and the page stays open. Adjustable: default mode, delay (0-10000ms),
image format, recording format, save directory, file-name pattern, hide DSH,
copy after save, window snapping, and the global hotkey switch plus chord. The
annotation colour and stroke are fixed (red #FF3B30, 4px). The toolbar has no
⚙ any more.
Shortcuts
The client registers three commands through ctx.shortcuts, so they are
rebindable in Settings -> Shortcuts:
| Command | Desktop default | Web default |
|---|---|---|
screenshot.capture | Shift+Alt+A | Ctrl+Shift+S |
screenshot.record | unbound | unbound |
screenshot.pinLast | unbound | unbound |
The in-app chord is dispatched by DSH itself. The optional system-wide hotkey
(the settings panel's global hotkey field, Shift+Alt+S by default) is a
separate mechanism and may differ from the in-app chord.
When ctx.shortcuts is unavailable the client falls back to an in-page keydown
listener.
Global hotkey (optional, off by default)
The Electron main process exposes no globalShortcut to the renderer, so
"capture while DSH is unfocused" is delivered by a resident PowerShell helper.
When enabled the Host spawns assets/hotkey-helper.ps1, which watches WM_HOTKEY
through RegisterHotKey plus an IMessageFilter and POSTs
{action:"hotkeyFired"} to the plugin's token-free loopback route
POST /api/quick-screenshot/hotkey (the helper has no browser session cookie,
so the authenticated Fetch route would reject it; the loopback route refuses any
non-loopback Host). The page polls GET ?hotkeyEvent=1 every 800ms — only
while globalHotkeyEnabled is true, and saving the settings panel also sends
POST {action:"hotkey",enabled} to start or stop the helper — sees the sequence
bump and captures. The helper's pid and stop files live at
%TEMP%\dsh-screenshot\hotkey-helper.pid|.stop; disabling the switch or unloading
the plugin writes the stop file for a clean exit and force-kills after 1.5s. The
helper is spawned without detached: true — on Windows that sets
DETACHED_PROCESS and the hidden WinForms message pump dies within a few hundred
milliseconds. If the chord is already taken by another app, enabling it fails with
409 HOTKEY_TAKEN instead of silently reporting success.
Where the image goes
With a composer mounted, the Client half follows the path the composer's own paste and drop intake take:
POST /api/quick-screenshotreturns the PNG bytes (and a small metadata header).ctx.conversation.createDrafts(sessionId, [file])registers the browser file and returns its draft id.- The
inputActionsstandard prop admits those ids withaddAttachments(ids)— the composer's rail then shows the thumbnail and the send serializes the image with the message.
With no composer mounted (the plugins page, Trajectory, Settings …) the same capture is written to the system clipboard instead, and the result bubble says so — paste it into a composer when the reader gets there. If the clipboard refuses the write, the bubble names the staged PNG on disk instead.
When those services are unavailable, the client falls back to dispatching a
synthetic paste event carrying the file on [data-composer-input="true"],
which is exactly what a manual paste does.
Host route
GET /api/quick-screenshot describes what this Host can capture right now
(supported, platform, tool, modes, directory); POST /api/quick-screenshot
takes an optional JSON body and answers with the PNG:
{ "mode": "window", "titlePattern": "DeepSeek Harness", "maxDimension": 0 }
| Field | Meaning |
|---|---|
mode | window (default), active, or screen |
titlePattern | Window title matched by window mode; defaults to DeepSeek Harness |
maxDimension | Optional cap on the longest side; 0 keeps the native capture size |
The response is image/png with Cache-Control: no-store and one
X-Screenshot header carrying percent-encoded JSON metadata
(mode, method, window, width, height, bytes, path). Failures answer JSON
with a stable code (CAPTURE_UNSUPPORTED, CAPTURE_TIMEOUT, CAPTURE_FAILED,
METHOD_NOT_ALLOWED, plus WINDOW_GONE, WINDOW_NOT_FOUND, WINDOW_GEOMETRY
and WINDOW_RESTORE_FAILED for the picker) and a message meant for the user. Both methods are
registered through ctx.connection.fetch, so the shared /api bridge applies
Host/Origin validation and browser-cookie authentication before the handler runs.
Action route (v2)
A POST /api/quick-screenshot carrying action dispatches instead of capturing:
| action | Fields | Answer |
|---|---|---|
upload | dataUrl (PNG data URL) | {ok,path,bytes,width,height} |
ocr | path | {ok,path,text,lines,language,width,height} |
pin | path, x, y, scale | {ok,pinId,path} |
unpin | pinId (0 closes all) | {ok,closed} |
save | path, optional saveDir/fileName | {ok,path,bytes}, code:"CANCELLED" when dismissed |
copy | path | {ok,path} |
record | x, y, width, height, fps, format, durationMs | {ok,jobId,path,pid} |
recordStop / recordCancel | jobId | {ok,path,bytes,format,durationMs} |
settings | none (read) or settings (write) | {ok,settings} |
hotkey | enabled | {ok,pid} |
hotkeyFired | — | {ok,seq} |
Query strings: ?windows=1, ?bounds=1 (virtual-screen rect, DPI and every window's
coordinates for snapping), ?settings=1, ?hotkeyEvent=1.
Capture backends
| Platform | Tool | Notes |
|---|---|---|
| Windows | powershell.exe + System.Drawing | PrintWindow(PW_RENDERFULLCONTENT) first, so an occluded window still captures; a flat result falls back to reading the same rectangle off the screen after raising the window. Per-monitor-v2 DPI aware. |
| macOS | screencapture -x -o | Display capture; window/active both resolve to the active display. |
| Linux | first of gnome-screenshot, spectacle, grim, import, scrot | Display capture. |
DSH_SCREENSHOT_POWERSHELL overrides the Windows shell (useful when only
PowerShell 7 is installed).
Captures are staged in <tmpdir>/dsh-screenshot/, and the directory keeps only
its newest 24 files, so the plugin owns no durable state and never grows
unbounded. One capture at a time: concurrent clicks queue instead of racing.
Install
Run the DSH Plugin Manager's install_bundle against this directory (a local
path spec), or add it to the profile's dsh.profile.bundles after installing it
with pnpm. The bundle's patch inserts one row, id: screenshot, naming this
package.
From a GitHub checkout, no build step is involved:
dsh plugin --profile web add github:fyb0603-bit/dsh-quick-screenshot
Publishing to the plugin market
The market lists plugins from the curated
awesome-dsh-plugin
list, not from its own repository — publishing means opening one entry-file PR
there. PUBLISHING.md has the whole path (naming conflicts, the
required dsh.bundle manifest, the dsh-plugin topic, the 1-day repository age
rule, the entry YAML, npm/tarball options, and the CI checklist).
screenshots.json already declares this plugin's storefront
screenshots from inside the repository.
The Host half loads with the new Loader row. Changing lib/index.js afterwards
needs a Host restart, because the Loader keeps Node's module cache for the life
of the process; lib/client.js re-reads from disk on a row toggle (bundle bytes
are revisioned by mtime, ctime and size).
Tests
Both suites run offline and need no browser:
node scripts/selftest.mjs # the Host route and real captures
node scripts/client-smoke.mjs # the Client bundle, control and attach flow
scripts/selftest.mjs drives the route with Fetch Request/Response objects and
spawns no PowerShell: capabilities, settings read, an unknown action answering
BAD_ACTION, hotkey event sequencing, a valid PNG data-URL upload landing on disk,
a non-PNG upload refused, and an out-of-range recording rectangle refused.
.github/workflows/test.yml runs both suites on every push and pull request with
that flag set, so the repository keeps a green check on a machine that has no
desktop.
scripts/client-smoke.mjs evaluates the bundle against a stub module loader and a
minimal React stub: it asserts all 31 exports, that inject carries shortcuts,
and that both locales are present; apply without a shortcuts service registers
all three seats (shell.overlay, conversation.input.left, settings.section),
installs the keydown fallback and starts the lightbox observer, while apply with one registers
screenshot.capture, screenshot.record and screenshot.pinLast, asserts the
desktop Shift+Alt+A and web Ctrl+Shift+S defaults, and checks that every
resolve({modal:null}) returns a runnable handler and modals: ["other"] lets it fire while a dialog that claims no shortcut scope is open.
Known limitations
- Window capture excludes overlapping windows but not popups.
PrintWindowrenders the window's own content; an open context menu drawn in a separate popup window is not part of it. - The screen rectangle fallback needs the window on top. It is only used when
PrintWindowreturns a flat image, and it raises the target window first. - macOS and Linux capture the display, not one chosen window.
- Images need an image-capable model. A text-only model refuses the attachment at send time with the composer's own error banner.
- The chord is a web chord. A browser that reserves
Ctrl+Shift+S(Save as) absorbs it before the page sees it; the button always works. - The Electron desktop shell is served over
http://127.0.0.1:<port>, so the Client half reaches/api/quick-screenshotas a same-origin request there as well.
Attribution
This package is derived from JackEngineer/dsh-quick-screenshot (v1.0.0, MIT). The upstream copyright notice is retained in LICENSE; version 2.x additions and modifications are by fyb0603-bit.
Related plugins
dsh-web-ui (dsh-tool-describe-image)
zhu1090093659/dsh-web-ui
modlens
liustack/modlens
ipollowork
devin-axis/ipollowork
dsh-image-gen
shanliuling/dsh-image-gen