Introduction¶
When using DSH Desktop, the built-in copy button can sometimes stop working. This is because the renderer in DSH Desktop runs in a sandboxed environment, and some browsers reject programmatic clipboard writes, making the button appear unresponsive. This affects the efficiency of copying code or text. The dsh-copy-fix plugin solves this issue through a bridging mechanism.
What Is It?¶
This is a DSH profile plugin maintained by lhh666-6. Its core function is to fix the copy button in packaged DSH Desktop Electron applications, allowing it to work properly in sandboxed environments.
Core Features¶
The plugin handles clipboard write operations using the following logic:
- Wraps calls to
navigator.clipboard.writeText. - First attempts a native browser clipboard write.
- POSTs the text to a plugin-owned loopback route.
- Writes the text using the Electron clipboard API in the main process.
- Falls back to
document.execCommand('copy')as a last resort.
Installation and Activation¶
In a DSH Desktop environment, install the plugin using the following commands:
# npm(推荐,已预构建)
dsh plugin --profile desktop add dsh-copy-fix
dsh plugin --profile web add dsh-copy-fix
# 或直接从 GitHub 安装
dsh plugin --profile desktop add github:lhh666-6/dsh-copy-fix
dsh plugin --profile web add github:lhh666-6/dsh-copy-fix
After installation, restart DSH Desktop for the plugin to take effect.
Use Cases and Notes¶
- Supported environments: Packaged DSH Desktop Electron applications only. It may not work in web environments or unpackaged development environments.
- Issue fixed: Mainly resolves the unresponsive copy button in sandboxed environments.
- Permissions and security: The plugin runs with the permissions of the current dsh process. It is recommended to review the source code and license before installation.
The plugin directory and source code are available at: https://www.skillhub.cn/plugins/lhh666-6/dsh-copy-fix