Introduction¶
Anyone who has developed DSH plugins has likely experienced this moment: wanting a model to see an error window, an image, or a piece of UI on the screen requires switching out, opening a screenshot tool, taking the shot, saving it, and then returning to DSH to drag the file into the input box. One operation requires jumping out of the current window three or four times. dsh-screenshot is designed for this flow: adding a “Screenshot” button below the input box; click it, and the DSH window closes down; you drag a box on the screen; upon release, that area is directly dropped into the input box’s attachment bar.
It is maintained by syhliuyiqing, categorized under Client, and currently has 2 stars on GitHub. Below is an introduction to its capabilities, boundaries, installation methods, and several implementation trade-offs.
What Is It¶
A DSH desktop plugin that uses three layers to automate the process of “screen area selection → becoming an attachment to be sent in the input box”. The entry point is only that button below the input box; there is no global hotkey.
The core problem solved is: reducing the number of steps required for a model to see screen content, completing the screenshot and submission in a single action. The prerequisites are Windows 10 / 11; screen capture uses PowerShell + GDI+; other platforms are not yet implemented.
Core Features¶
-
Click the “Screenshot” button → DSH window minimizes → entire screen dims → mouse cursor turns into a crosshair → drag a rectangular box → release to crop the selected area → DSH pops back to the foreground → PNG appears in the input box’s attachment bar.
-
Hold
Altand click to directly screenshot the entire screen, bypassing the selection box. -
Real-time display of
Width x Heighton the box border during the drag. -
Right-click or
Escto cancel; nothing is added, and no error is shown. -
If the long side of the output exceeds 1920, it automatically scales down by one notch to avoid feeding several MB of raw images directly to the model; the selected image is preserved by default unless it already exceeds 1920.
Installation and Enabling¶
The official method only provides local directory installation; there is no command like dsh plugin add github:.... There are two ways:
Method 1: Add the local directory in the DSH “Plugins” page (Local Directory Installation).
Method 2: Have the Agent call the plugin_manager’s install_bundle, pointing to the absolute path of this directory.
After installation, you need to refresh the page. If updating from an older version, you need to fully exit DSH before reopening; only then will the Host load the new code.
Two prerequisites: DSH Desktop version 0.2.1 or higher; and the system’s built-in Windows PowerShell 5.1 is sufficient; no need to install pwsh.
Typical Usage¶
After installation, the operations are as follows:
| Operation | Result |
|---|---|
| Click “Screenshot” | Select an area |
Alt + Click |
Full screen |
| Drag | Select, real-time dimension display |
Right-click / Esc |
Cancel |
The entry point is only that button below the input box. If you need to screenshot a menu expanded within an application, you need to use a shortcut key to bring the menu up first, then click Screenshot—because the selection period is full-screen modal.
Implementation and Trade-offs¶
The plugin consists of three files, each managing a section:
| File | Responsibility |
|---|---|
client.js |
The button below the input box. Upon receiving the image, it calls conversation.createDrafts() + inputActions.addAttachments() to turn the PNG into a pending attachment in the input box |
index.js |
Host side. Registers POST /dsh-screenshot/capture, passes authentication via ctx.connection.requestRejection(), and then serializes the PowerShell execution via the Host’s subprocess service to return PNG bytes |
capture.ps1 |
Does the actual work: finds the DSH window handle along the process tree → minimizes → captures the virtual desktop → lays out a selectable area mask → crops/scales → saves PNG → restores the window regardless of success or failure |
Several notable design trade-offs:
- Screenshot the whole screen first, then select. Selection is cropped from that original image, so the output won’t carry a mask, border, or dimension hints, and it avoids timing issues like “starting to capture before the window is fully minimized.”
- Selector compiled only once. Compiling C# selectors on a cold machine takes over ten seconds; the compiled artifact is cached to
%TEMP%\dsh-screenshot\selector-v1.dll, so subsequent calls stabilize around 1.5 seconds. - Authentication uses DSH’s own system. The route doesn’t have separate authentication; it directly uses
connection.requestRejection(), so only pages with the local browser session cookie can call it;curlfrom the command line gets a 401. - Images do not land on disk. The Host writes to a temporary directory, and the client deletes it immediately after fetching the bytes; aside from this one temporary file, the image does not go anywhere else.
- Starting the process uses the Host’s
subprocessservice, not directly importing Node’s process module: the executable file is resolved by the provider, stdio and cleanup are also handled by the provider, so the plugin doesn’t retain raw process capabilities.
Known Limitations¶
- Only Windows.
- Coordinates may be off when using multiple monitors with different scaling ratios (currently handled by system DPI).
- Full-screen modal during selection; content like expanded menus must be brought up before capturing.
- No global hotkeys; the entry point is only that button below the input box.
Use Cases and Notes¶
Suitable for users on Windows using the DSH Desktop version who frequently need to show screen content to the model. Its screenshot capability runs with the permissions of the current DSH process; capture.ps1 minimizes/restores windows and calls PowerShell + GDI+; before installation, you should read the source code to confirm the license is MIT before deciding whether to introduce it.
Conclusion¶
The value of dsh-screenshot lies not in its power, but in condensing a multi-step repetitive operation into a single click, while cleanly handling window lifecycle, temporary files, and authentication. The directory page is at https://www.skillhub.cn/plugins/syhliuyiqing/dsh-screenshot, and the source code is at https://github.com/syhliuyiqing/dsh-screenshot.