Skip to content

Commit

Permalink
feat: support duplicating tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanSalt committed Feb 28, 2021
1 parent 79a05a3 commit 59684a8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions addons/menu/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"Quit %A#!menu.quit": "退出 %A",
"Terminal#!menu.terminal": "终端",
"New Tab#!menu.newtab": "新建标签页",
"Duplicate Tab#!menu.duplicatetab": "复制标签页",
"New Window#!menu.newwindow": "新建窗口",
"Show Tab Options#!menu.showtaboptions": "展示标签页选项",
"Select Previous Tab#!menu.previoustab": "选择上一个标签页",
Expand Down
9 changes: 9 additions & 0 deletions renderer/hooks/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,15 @@ export function handleTerminalMessages() {
ipcRenderer.on('open-tab', (event, options: CreateTerminalTabOptions) => {
createTerminalTab(options)
})
ipcRenderer.on('duplicate-tab', event => {
const currentTerminal = unref(useCurrentTerminal())
if (currentTerminal) {
createTerminalTab({
cwd: currentTerminal.cwd,
shell: currentTerminal.shell,
})
}
})
ipcRenderer.on('close-tab', () => {
const currentTerminal = unref(useCurrentTerminal())
if (currentTerminal) {
Expand Down
5 changes: 5 additions & 0 deletions resources/terminal.menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"accelerator": "CmdOrCtrl+T",
"command": "open-tab"
},
{
"label": "Duplicate Tab#!menu.duplicatetab",
"accelerator": "CmdOrCtrl+Shift+D",
"command": "duplicate-tab"
},
{
"label": "New Window#!menu.newwindow",
"accelerator": "CmdOrCtrl+N",
Expand Down

0 comments on commit 59684a8

Please sign in to comment.