Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

feat: 非主窗口在帮助右侧显示「子窗口」Chip (#1185)

Hairy7ddf7920c13f
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index 5dae8db8..211f9153 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -209,6 +209,7 @@
"nav.background": "Background",
"nav.close": "Close window",
"navbar.nightly_build": "Nightly build",
+ "navbar.child_window": "Child window",
"messages.logs_copied": "Logs copied to clipboard",
"messages.logs_read_failed": "Failed to read logs. Please try again.",
"app.help": "Help",
diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json
index 1ea568b8..2a2caaf5 100644
--- a/src/i18n/locales/zh-CN.json
+++ b/src/i18n/locales/zh-CN.json
@@ -209,6 +209,7 @@
"nav.background": "后台化",
"nav.close": "关闭窗口",
"navbar.nightly_build": "夜间构建版本",
+ "navbar.child_window": "子窗口",
"messages.logs_copied": "日志已复制到剪贴板",
"messages.logs_read_failed": "读取日志失败,请稍后重试",
"app.help": "帮助",
diff --git a/src/layout/components/navbar-window-close.test.tsx b/src/layout/components/navbar-window-close.test.tsx
index 96bd3b72..2eef091d 100644
--- a/src/layout/components/navbar-window-close.test.tsx
+++ b/src/layout/components/navbar-window-close.test.tsx
@@ -96,6 +96,17 @@ describe('navbar window close', () => {
expect(native).not.toHaveBeenCalledWith(otherCommand, expect.anything())
})
+ it.each(['main', 'window-2', 'remote-2'])('marks %s as a child window only when it is not the main window', (label) => {
+ mockWindows(label)
+ render(<Navbar onRemoteChange={vi.fn()} />)
+
+ const chip = screen.queryByTestId('dsh-navbar-child-window-chip')
+ if (label === 'main')
+ expect(chip).toBeNull()
+ else
+ expect(chip?.textContent).toBe('navbar.child_window')
+ })
+
it('keeps the main window close labeled as backgrounding to the tray', () => {
mockWindows('main')
render(<Navbar onRemoteChange={vi.fn()} />)
diff --git a/src/layout/components/navbar.tsx b/src/layout/components/navbar.tsx
index b6d607a2..5fb30605 100644
--- a/src/layout/components/navbar.tsx
+++ b/src/layout/components/navbar.tsx
@@ -39,8 +39,10 @@ import { IS_MACOS, onDragRegionPointerDown, useMacOSFullscreen, useMaximized } f
/**
* 壳层窗口顶部导航栏(44px,常驻):
*
- * [侧边栏(展开/收起)] [文件][运行][帮助][更新可用] [ 空白拖拽区 ] [远程][本地/远端] [最小化][最大化][关闭(X)]
+ * [侧边栏(展开/收起)] [文件][运行][帮助][子窗口][更新可用] [ 空白拖拽区 ] [远程][本地/远端] [最小化][最大化][关闭(X)]
*
+ * - 子窗口:非主窗口(`window-N` / `remote-N`)在「帮助」右侧挂一个「子窗口」Chip,
+ * 主窗口不渲染——多开出来的窗口外观完全相同,靠它区分。
* - 侧边栏:经 postMessage 操控 iframe 内的 dsh 应用
* (`dsh://sidebar:toggle`,由 dsh-tauri 插件的 `client/register/sidebar.ts`
* (`ctx.layout.toggleSidebar`)执行);折叠图标由 iframe 回报的
@@ -247,6 +249,7 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
// 仅当 dsh-tauri 插件启用(已安装)时显示左侧导航控件
const tauriEnabled = plugins.some(plugin => plugin.id === TAURI_PLUGIN_ID)
+ const isMainWindow = getCurrentWindow().label === 'main'
const isNightly = appIdentifier === 'dsh-tauri-nightly'
const showUpdateAvailable = appIdentifier != null && !isNightly && updateInfo != null
@@ -747,6 +750,12 @@ export function Navbar({ onRemoteChange, sidebarCollapsed = false, onToggleSideb
</div>
</If>
+ <If cond={!isMainWindow}>
+ <Chip className="ml-1 shrink-0 text-xs" color="default" size="sm" variant="soft" data-testid="dsh-navbar-child-window-chip">
+ {t('navbar.child_window')}
+ </Chip>
+ </If>
+
<If cond={isNightly}>
<Then>
<Chip color="accent" size="sm" variant="soft" className="ml-1 text-xs mr-1">