Click a delivered-file card to open the file with the system default application instead of DSH's built-in sidebar preview; hold Shift to keep the original preview.
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-open-native
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:Lessthinker66/dsh-open-native
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
两件事都交回系统处理:
- 点交付卡片 → 用系统默认程序打开文件(
.xlsx就是 WPS),不再跳进 DSH 右侧的内置预览。 - 点正文里的链接 → 用系统默认浏览器打开,不再落进 DSH 的内置浏览器侧边栏。
为什么需要它
DSH 把这些动作都收进了自己的界面里,而且没有设置项能改:
- 交付卡片(
present出来的文件那个卡片)把两件事刻意分开了:点卡片本体 = 在右侧 Sidebar 内嵌预览;用系统默认程序打开 = 卡片上另一个独立的分体按钮「打开(默认)」。 本插件把前者改成后者。 - 正文里的链接:DSH 有自己的浏览器侧边栏,点链接会往里开;想用系统浏览器得再点工具栏 上那个「在外部打开」的小图标。本插件省掉这一步,点链接直接就出去。
注意:这个插件只负责「走哪条打开通道」。文件最终由哪个程序接管,仍然取决于 Windows 对那个扩展名的默认程序关联。如果点开发现是微软 Office 而不是 WPS, 那是系统关联的问题(
FileExts\.xlsx\UserChoice的哈希失效),不是插件的问题。链接同理:最终用哪个浏览器,取决于 Windows 对
http/https的默认协议处理。
怎么做的
改动全在浏览器端,不碰 DSH 本体(不改 app.asar,升级不会丢)。
交付卡片
- DSH 的卡片里那个铺满整块的预览按钮,
title属性上挂的就是解析后的绝对路径 (resolveWorkspacePath(cwd, file.path))。 - 原生打开的通道是宿主的
session.openWorkspacePath({ path })。 - 本插件在
document的捕获阶段监听click:命中[data-presented-file]卡片、 且不是点在卡片右下角的动作按钮上时 →preventDefault()掉原来的预览 → 改调session.openWorkspacePath。
链接
- 命中
a[href]且href是http:/https:/mailto:时 →preventDefault()+stopPropagation()→window.open(url, "_blank", "noopener,noreferrer")。 - 这里用的是和 DSH 自己「在外部打开」按钮完全同一套做法
(见
@deepseek-ai/dsh-client-ui-sidebar-browser里的那个工具栏按钮), 桌面端会经宿主的windowOpenHandler落到系统浏览器上。 - 站内锚点(
#foo)、相对路径、应用内部路由一律不碰,交回 DSH 自己处理。
保留原来的行为
按住 Shift(或 Ctrl / Alt / Cmd) 点击,仍然走 DSH 原本的处理:
- 点卡片 → DSH 内置的侧边栏预览
- 点链接 → DSH 的内置浏览器侧边栏
安装
这是一个标准的 DSH 插件包(dsh.bundle.patch + dsh.client):
dsh plugin --profile desktop add dsh-open-native
# 或者用本地打包好的文件:
dsh plugin --profile desktop add file:/绝对路径/dsh-open-native-1.2.0.tgz
装完在 DSH 可视化页面的「插件」面板里就能看到它(标题「原生打开」,带图标), 可随时启用/停用。
包装内容
| 文件 | 作用 |
|---|---|
lib/index.js |
宿主半区:不注册任何服务,只为让 bundle 能被加载 |
lib/client.js |
客户端半区:捕获阶段的点击拦截,真正干活的部分 |
cordis.patch.yml |
bundle 补丁,把本插件挂进 profile |
icon.svg |
插件面板里的图标(package.json 的 icon 字段) |
locale/en.json、locale/zh.json、locale/zh-CN.json |
面板里显示的名称与描述 |
package.json 里的 dsh.engines.dsh 声明了适用的 DSH 版本(>=0.2.0-rc.2),
是给插件市场做兼容判断用的元数据。
排错
按 F12 打开开发者工具,看 Console 里有没有 [dsh-open-native] 开头的警告:
宿主没有受理原生打开→ 宿主拒绝了这次调用(路径不在会话工作区内,或宿主没装 原生打开能力)。调用 window.open 失败→ 浏览器拦了这次弹窗。- 什么都没打出来 → 说明点击没被识别成卡片/链接,多半是 DSH 改了 DOM 结构(见下)。
它可能在什么时候坏
插件靠两个 DOM 特征认卡片、靠一个选择器认链接,DSH 大版本更新后可能要跟着调:
- 卡片容器:
[data-presented-file] - 预览按钮:
button的 class 里含cardPreview - 链接:
a[href](另加http/https/mailto前缀白名单)
前两处都在 lib/client.js 顶部的常量里。改完记得重新打包并向 profile 重装一次。
预览按钮那条有退路:类名对不上时,插件会退回「卡片里第一个 title 是绝对路径的按钮」,
所以 DSH 单纯重命名 CSS module 不会让它整个失效——真正会一击致命的是卡片容器标记。
另外路径必须长得像绝对路径(C:\、\\、/ 开头)才会被打开,避免把 title
上的普通文案当成路径去调宿主。
链接那条相对稳:a[href] 是 HTML 标准,不太会变;真正可能变的是
「DSH 打开外链的方式」——如果哪天它不再走 window.open,这里要跟着换。
版本
- 1.2.0 — 新增:点正文链接用系统默认浏览器打开。
- 1.1.1 — 修好
package.json里的仓库地址与作者(换到公开的个人账号)。 - 1.1.0 — 预览按钮识别加了退路;路径改为从「这一下真正点到的按钮」上取, 卡片里出现多个文件时不会认错。
- 1.0.0 — 首个版本。
Links
More in this category
zhu1090093659/dsh-web#packages/dsh-task-board★ 10696
Task board for the dsh web GUI: a sidebar multi-column kanban whose cards run in real DSH agent sessions and can also be scheduled with cron expressions, executed host-side even with the browser closed.
zhu1090093659/dsh-web#packages/dsh-web-all★ 10696
Plugin and skin collection for the DSH Web UI: task board, Git graph, right-side panel, remote mobile UI, pet, live token stats, and a skin center.
ccch1mneyyy/dsh-TUI★ 8484
Claude Code-style full-screen terminal UI: pixel-whale header, live status line, and streaming thought expansion.
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 7509
A fixed-corner whale widget for the DSH web GUI — balance, today's usage and per-turn cost with peak/off-peak pricing, editable balance-alert and daily-budget bubbles, a module-based custom bubble queue with A/B weighted choices and random lines or images, 30+ vendor templates (OpenAI, OpenRouter, Kimi, SiliconFlow, Ark, Zhipu, MiniMax and more) with per-model balance and subscription quota, plus task-end sound, imported audio, custom roles and a resource manager. Local-only, no telemetry.
omdsh-dev/DSH-better-sidebar★ 5395
Full sidebar workbench with file rendering and editing, terminal, Git, and subagents; third-party plugins can register new tabs.
omdsh-dev/dsh-genui★ 1082
Interactive UI components rendered inline in replies: layout, charts, forms, quizzes, mermaid, 3D scenes, and an action event loop back to the model.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.