Introduction¶
When you need to share a screen region with an AI agent during a local conversation, the typical workflow involves manually taking a screenshot and dragging it into the chat box. The back-and-forth of copying, uploading, and explaining adds friction and room for error. DeepSeek Harness (DSH) embraces the philosophy of “everything is a plugin.” Community developer chguo-3 built a “screenshot button for the chat box” plugin: click it to freeze the screen, then select, resize, and annotate directly on your desktop. Once confirmed, the cropped result is attached as an image to the current conversation draft.
Plugin Overview¶
dsh-screenshot is a DSH client plugin (category: Client) open-sourced by maintainer chguo-3 (MIT License, v0.7.0). It does not rely on any third-party screenshot library; instead, it invokes native OS capabilities directly through the DSH Plugin Host. On Windows, it uses the native editor to guarantee physical-pixel output, avoiding the blurriness caused by DPI scaling.
Core Features¶
- Full-screen freeze + region selection: Click the camera icon in the input toolbar. The screen freezes and darkens, displaying a crosshair cursor. Drag to select a region (release without dragging = full screen).
- Selection adjustment: After releasing the mouse, a floating toolbar lets you modify the selection—supports scaling via 8 control points, moving the entire selection, or re-dragging outside the box.
- In-place annotation: Brush / Rectangle / Arrow tools in red, yellow, and blue. Press
Ctrl+Zto undo. - Floating toolbar: Anchors to the bottom-right corner of the selection (automatically flips above if there’s no room), staying out of the way during drag operations.
- Window hiding: Check “Hide DSH window during capture” to hide the DSH window before the screenshot and restore it afterward, preventing the window from appearing in the capture.
- Physical-pixel output: The Windows process enables DPI awareness first, so output at 125% / 150% scaling remains sharp.
- Draft pipeline: After cropping and baking in annotations, the image enters the DSH draft pipeline via
conversation.createDrafts(sessionId, [file])→inputActions.addAttachments(ids). If rejected, the attachment is rolled back and a notification is shown. - Local loopback only: Everything runs over the local loopback interface. Temporary images are deleted immediately after use.
Installation & Setup¶
Prerequisites: DSH desktop client + Windows 10/11 (relies on PowerShell 5.1 and the WinForms / System.Drawing APIs bundled with .NET Framework).
git clone https://github.com/chguo-3/dsh-screenshot.git
In the DSH Plugin Manager, install this directory (the bundle entry point is this directory; install type: local directory / install_bundle). After installation, refresh the window (Ctrl+R) and locate the camera button in the input toolbar—find it at + · Full Access · 😊 · 📷 · + Skill (positioned to the right of the emoji button).
If the button does not appear after installation, check the following in order:
- Whether the
conversation.input.leftslot contains ascreenshotoccupant. - Open
http://127.0.0.1:<DSH port>/dsh-screenshot/diag—it should return{"ok":true,...}.
Typical Usage¶
- Click the camera icon → screen freezes and darkens, crosshair cursor appears.
- Drag to select a region (release without dragging = full screen).
- After releasing, use the floating toolbar to switch tools:
Selection / Brush / Rectangle / Arrow / Color Picker / Undo / Clear / Cancel / Done. - Press
Enteror click “Done” → crop + bake in annotations → enter the draft. - Press
Esc/ right-click / close the window → cancel, leaving no trace.
Shortcuts: 1–4 to switch tools; Ctrl+Z to undo; Ctrl+C to copy the current crop to the clipboard; Esc to cancel; Enter to confirm.
Hiding the DSH Window During Capture¶
Click the small arrow to the right of the button to open the menu. After checking “Hide DSH window during capture”:
- The DSH window is hidden before the screenshot, so you capture the desktop without the window itself in the frame (the preference is persisted).
- The window is restored immediately after capture. Even if the script is force-killed, the plugin will restore the window on next launch based on a marker file.
Technical Implementation¶
The renderer process does not have access to desktopCapturer (the DSH desktop shell does not register setDisplayMediaRequestHandler), so screenshot capture is delegated to the Plugin Host—a plain Node.js process that can directly invoke OS capabilities:
client.js: Registers the camera button inconversation.input.leftand registers failure notifications inshell.overlay.index.js: Registers local loopback routes under/dsh-screenshot/*, writesselector.ps1to a temporary script, and executes it.selector.ps1: Windows full-screen editor—freezes the entire screen → select / adjust region / annotate → crops at physical pixels and bakes in annotations.
Once the PNG is obtained, it flows through DSH’s own draft pipeline: conversation.createDrafts(sessionId, [file]) → inputActions.addAttachments(ids). On rejection, releaseDraftAttachments rolls back and shows a notification.
Routes (only accepts requests where the Host header is a loopback address):
GET /dsh-screenshot/capture: Interactive screenshot, returnsimage/png; user cancellation returns409 {"cancelled":true}.GET /dsh-screenshot/capture?mode=full: Full-screen capture (for debugging).GET /dsh-screenshot/capture?rect=x,y,w,h: Skips interaction and crops directly (for unattended self-tests).GET /dsh-screenshot/capture?hide=1: Hides the DSH window during capture.GET /dsh-screenshot/diag: Runtime environment self-check.
Other platforms:
- macOS:
screencapture -i -x(system interactive selection; no annotation or floating toolbar). - Linux: Tries
gnome-screenshot -a/spectacle -r/maim -s/scrot -sin sequence.
Known limitations:
- Annotation, selection adjustment, and the floating toolbar are currently only available in the Windows native editor.
- Multi-monitor: the freeze covers the entire virtual screen; cross-monitor drag selection works.
- Window hiding relies on window title matching (
DeepSeek Harness). If you change the title, you must updateselector.ps1.
Diagnostics & Debugging¶
PowerShell self-test example (replace <port> with your actual DSH port):
Invoke-WebRequest 'http://127.0.0.1:<port>/dsh-screenshot/capture?mode=full' -OutFile shot.png
Invoke-WebRequest 'http://127.0.0.1:<port>/dsh-screenshot/capture?rect=100,120,640,400' -OutFile crop.png
Invoke-WebRequest 'http://127.0.0.1:<port>/dsh-screenshot/capture?rect=100,120,640,400&hide=1' -OutFile crop2.png
selector.ps1 has two debug switches:
DSH_SHOT_SELFTEST=1: Pre-loads three annotation strokes to verify baking.DSH_SHOT_DEMO=1: Pre-loads a selection region to verify the toolbar and control points.
Use Cases & Caveats¶
- Ideal for users who frequently need to share screen regions with an AI agent or explain UI details in a conversation.
- The plugin runs with the permissions of the current DSH process. Review the source code and license (MIT) before installing.
- Linux / macOS only provide system interactive selection; annotation and the floating toolbar are not available.
- The window-hiding feature depends on window title matching (
DeepSeek Harness). If you change the title, you must modifyselector.ps1.
Summary¶
dsh-screenshot compresses the “screenshot → upload → attach” workflow into four steps: click the camera button, select a region, annotate, and confirm. The result goes directly into the draft. For local conversations and debugging scenarios, it reduces manual operations and copy-pasting, letting the agent focus on the content itself.
- GitHub: https://github.com/chguo-3/dsh-screenshot
- Directory page: https://www.skillhub.cn/plugins/chguo-3/dsh-screenshot