dsh-rightbar-default-width
Manifest validDSH Web plugin: right sidebar defaults to a configurable fraction of the viewport (1/6 by default) instead of half the screen, while keeping drag-to-resize and remembering the width you dragged to.
右侧栏默认宽度不是半屏,而且仍然可以拖
把 DSH 右侧栏的默认宽度从「半屏(视口 45%)」改成可配置的比例(默认 1/6), 同时保留拖拽调宽的能力,并记住你拖过的宽度。
为什么需要这个东西
DSH 的右栏宽度有两个坑,叠在一起:
- 默认是半屏:
openRightbar里rightbar ??= 视口 × 0.45(@deepseek-ai/dsh-client-ui-layout/lib/client.js:429,RIGHTBAR_DEFAULT_RATIO = .45) - 不持久化:该包全文没有 localStorage 写入,所以每次刷新/重启都回到半屏,只能手拖一次
于是「每次开面板都要拖一下」成了常规操作。
为什么不能用 CSS 改
宽度最终落在内联样式上:
| 部位 | 位置 |
|---|---|
| 轨道(三列 grid) | layout/client.js:318-321 gridTemplateColumns |
| 面板(absolute 定宽) | sidebar-right/client.js:5709-5710 width / --dsh-sidebar-width |
按 CSS 层叠规则:
- 普通样式表规则打不过内联声明 → 改不了宽度
- 带
!important的规则能改 → 但把拖拽写的新值也一并盖掉
结论:「默认窄」和「可以拖」用 CSS 无法兼得。(这正是我上一版配置的处境:宽度锁死 320px,拖不动。)
本插件怎么做的
改的是 state,不是渲染结果 —— 所以两者兼得。
ctx.layout 是 LayoutController 实例,它的 panels 字段就是 layout store 的 actions 对象:
layout/client.js:595 new LayoutController(instance.actions, …)
layout/client.js:457 this.panels = panels
renderer/client.js:730 kit["actions"] = store.actions ← 拖拽用的也是这个
而这个 actions 里有 setRightbar(layout/client.js:422),拖拽走的是同一个
(layout/client.js:296 actions.setRightbar(rightbarBase.current - dx))。
所以:
- 右栏首次打开之前调用一次
setRightbar(视口 × 1/6)→openRightbar里的??=成了空操作,半屏默认值永远不会写入 - 包装
setRightbar,把用户拖拽的宽度记进localStorage→ 下次启动优先用它 - 自己调用时置
selfApplying标志,不把初始化误记成拖拽
因为改的是 state,拖拽完全不受影响,两者不打架。
安装
# 1) 复制/克隆到任意目录,例如
git clone https://github.com/OctoberaYours/dsh-rightbar-default-width C:\Users\<你>\Code\dsh-rightbar-default-width
# 2) profile 的 package.json —— 【两处都要写】,只写一处会被静默启停
# ~/.dsh/profiles/<profile>/package.json
{
"dependencies": {
"dsh-rightbar-default-width": "link:C:/Users/<你>/Code/dsh-rightbar-default-width"
},
"dsh": {
"profile": {
"bundles": [
// …
"dsh-rightbar-default-width"
]
}
}
}
# 3) link 安装要真 junction(bundle 解析会检查 node_modules/<name>/package.json)
cd ~/.dsh/profiles/<profile>/node_modules
cmd /c mklink /J dsh-rightbar-default-width C:\Users\<你>\Code\dsh-rightbar-default-width
# 4) 客户端插件 → 刷新页面即可(host 半边是空的,不涉及重启)
配置
改默认比例:在浏览器 DevTools 控制台执行,下次启动生效:
__dshRightbarWidth.setRatio(1/5) // 1/5 屏;想更窄写 1/8
其它便利口:
__dshRightbarWidth.current() // 当前记住的宽度(px),没记过则是 undefined
__dshRightbarWidth.set(420) // 立即改成 420px 并记住
__dshRightbarWidth.forget() // 忘掉拖拽宽度,回落到默认比例
想直接改死默认值:编辑 lib/client.js 的 DEFAULT_RATIO。
已知边界
- 只对
layout服务存在的客户端生效。找不到ctx.layout.panels.setRightbar时本插件静默退出,不报错、不影响其它功能 —— 因此 DSH 升级换掉这套 API 时 它是「失效」而不是「炸掉」。 - 记住的是像素值,不是比例。换显示器/改窗口宽度后,若旧值超出新视口的
clamp(300, 视口×0.7)范围,DSH 自己会把它夹回合法区间(这是它的行为)。 - 若同一 page 内组件重挂(HMR),包装会在卸载时还原,不会链式叠加。
- 不对其它 profile 生效:每个 profile 各自装配,要在
web也用就照样加一遍。
许可
MIT — 见 LICENSE。
Comments
Loading…
From the same category
DeepSeek Harness plugin for Reactive Resume: bridges your resumes and job applications into a Harness session over MCP.
★ 41.7k
↓ 223/wk
MIT
Aug 24, 2026
dsh plugin --profile web add dsh-plugin-reactive-resumeby Tencent
Let AI agents use your real, logged-in browser without interrupting your work. CLI + extension for browser automation across any shell-capable AI agent.
★ 8.4k
↓ 7.5k/wk
MIT
TypeScript
Oct 8, 2026
dsh plugin --profile terminal add @wxg-prc-cpg/browser-skill-dsh-pluginby yjh051108
dsh-routing-suite — injector + router-standard kit: install the runtime injector first, then the task-aware reasoning-mode router preset (measured P1-P23).
★ 7k
MIT
JavaScript
Sep 18, 2026
dsh plugin --profile web add @dsh-external/dsh-super-injectorby Q00
Agent OS: the agent gets smarter on its own. We just hold the line: Interview-gated, staged evaluation, budgeted evolution loop. MCP server, 14 runtimes: Claude Code, Codex CLI, Gemini CLI, OpenCode,
★ 6.2k
MIT
Python
Oct 7, 2026
by dsh-market
The plugin market inside DeepSeek Harness — browse, search, one-click install · DSH 可视化插件市场
★ 5.8k
↓ 156.3k/wk
MIT
TypeScript
Oct 8, 2026
dsh plugin --profile web add dshmarketby superdesigndev
OpenRouter for agent tools. Join community here: https://discord.gg/6mQYYfFMAn
★ 4.8k
NOASSERTION
Python
Oct 8, 2026
dsh plugin --profile web add treg-dsh