From 495c4e57dfe797f714f0757425289505f0da25e8 Mon Sep 17 00:00:00 2001 From: wayne Date: Sat, 11 Apr 2026 18:53:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(terminal):=20=E6=B7=BB=E5=8A=A0=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=20tmux=20=E6=81=A2=E5=A4=8D=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当终端存在 tmux session 时,在右键菜单中新增"复制 tmux 恢复命令"选项。 Co-Authored-By: Claude Opus 4.6 --- src/renderer/components/chat/AgentTerminal.tsx | 15 +++++++++++++++ src/shared/i18n.ts | 1 + 2 files changed, 16 insertions(+) diff --git a/src/renderer/components/chat/AgentTerminal.tsx b/src/renderer/components/chat/AgentTerminal.tsx index 24601163..9fb2ca90 100644 --- a/src/renderer/components/chat/AgentTerminal.tsx +++ b/src/renderer/components/chat/AgentTerminal.tsx @@ -877,6 +877,15 @@ export function AgentTerminal({ { id: 'copy', label: t('Copy'), disabled: !terminal?.hasSelection() }, { id: 'paste', label: t('Paste') }, { id: 'selectAll', label: t('Select all') }, + ...(tmuxSessionNameRef.current + ? [ + { id: 'separator-2', label: '', type: 'separator' as const }, + { + id: 'copyTmuxRestore', + label: t('Copy tmux restore command'), + }, + ] + : []), ]; const selectedId = await window.electronAPI.contextMenu.show(menuItems); @@ -910,6 +919,12 @@ export function AgentTerminal({ case 'selectAll': terminal?.selectAll(); break; + case 'copyTmuxRestore': + if (tmuxSessionNameRef.current) { + const restoreCmd = `tmux -L enso attach-session -t ${tmuxSessionNameRef.current}`; + navigator.clipboard.writeText(restoreCmd); + } + break; } }, [terminal, clear, refreshRenderer, t, onSplit, canMerge, onMerge, onFocus] diff --git a/src/shared/i18n.ts b/src/shared/i18n.ts index c840ff07..5e2029b6 100644 --- a/src/shared/i18n.ts +++ b/src/shared/i18n.ts @@ -152,6 +152,7 @@ export const zhTranslations: Record = { 'Copy Commit ID': '复制 Commit ID', 'Copy Path': '复制路径', 'Copy Relative Path': '复制相对路径', + 'Copy tmux restore command': '复制 tmux 恢复命令', 'Revert commit': 'Revert 提交', 'Reset to commit': 'Reset 到此提交', 'Select reset mode for commit': '选择 Reset 模式',