README来源: main@51aa8086
dsh-hide-buttons
Hide the conversation-header utility buttons and the sidebar plugin-market launcher with injected CSS — appearance only, no layout or behavioral change.
用注入的 CSS 隐藏会话头部右侧的 utility 按钮组(含 Session log 导出)与侧栏底部的插件市场启动按钮;纯外观,不改布局与行为。
它隐藏什么
| 目标 | 选择器 | 说明 |
|---|---|---|
| 会话头部 utilities 容器 | [class$="_headerUtilities"] |
官方把 Session log 等按钮渲染在这个容器里;CSS Modules 的哈希前缀随前端构建变化,但 _headerUtilities 后缀恒定,所以按属性后缀命中容器 |
| 导出按钮(后备规则) | .session-log-download |
万一按钮移到容器外,仍按原类名隐藏 |
| 侧栏底部「插件市场」启动按钮 | .dshMarketLauncher |
固定字面量类名(非哈希),可直接命中。市场功能本身不受影响:设置 → 插件 → 市场 tab 照样能用 |
注入是幂等的:<style id="dsh-hide-buttons-style"> 已存在就直接返回。要恢复原样,删掉插件的
cordis 行即可(不用重启应用,刷新页面即可)。
安装
两种装法任选其一(都会往 profile 的 dependencies 加一项,再配一行 insert):
# ① npm(快,走 registry)
dsh plugin --profile <profile> add dsh-hide-buttons
# ② GitHub(源码直装,跟随 main 分支)
dsh plugin --profile <profile> add github:jipika/dsh-hide-buttons
# ~/.dsh/profiles/<profile>/cordis.patch.yml
- insert:
- id: dsh-hide-buttons
name: dsh-hide-buttons
desktop profile 被 Electron 独占(CLI 子命令会被拒),需手改 package.json + pnpm install;
改 client 半边必须重启应用(client bundle 在 host 启动时读进内存,刷新页面无效)。
实现
dsh-hide-buttons
├─ lib/index.js host 半边:空 apply(),只为让 cordis 行能挂载 client bundle
└─ lib/client.js 浏览器半边:__ModuleLoader__.load → 注入一段 <style>
client 半边 inject = [],不注册任何 slot,也不碰官方 DOM 结构 —— 只追加一个 <style> 元素。
已知限制
- 依赖官方类名(
_headerUtilities后缀 /.dshMarketLauncher字面量),前端大改即可能失效。 - 用
display: none !important隐藏整个 utilities 容器,所以同容器里的其它按钮会一起消失 (这是刻意的:只留主操作,去掉杂项)。 - 只做减法:想单独控制某一个按钮,需要改选择器。
License
MIT © 2026 jipika
还没有评论,来写第一条。