From 5e199df433607e94e7cb15219d56462320a4df16 Mon Sep 17 00:00:00 2001 From: Qiming-Liu Date: Sat, 2 Jul 2022 17:19:43 +0930 Subject: [PATCH 1/2] feat: tab context menu 'Restart' --- tabby-core/src/tabContextMenu.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tabby-core/src/tabContextMenu.ts b/tabby-core/src/tabContextMenu.ts index d45b65e07b..3572239a92 100644 --- a/tabby-core/src/tabContextMenu.ts +++ b/tabby-core/src/tabContextMenu.ts @@ -120,6 +120,17 @@ export class CommonOptionsContextMenu extends TabContextMenuItemProvider { label: this.translate.instant('Duplicate'), click: () => this.app.duplicateTab(tab), }, + { + label: this.translate.instant('Restart'), + click: () => { + this.app.duplicateTab(tab) + if (this.app.tabs.includes(tab)) { + this.app.closeTab(tab, true) + } else { + tab.destroy() + } + }, + }, { label: this.translate.instant('Color'), sublabel: currentColor ? this.translate.instant(currentColor) : undefined, From 786cf472942fe99a76211111e118e46f1c5e890a Mon Sep 17 00:00:00 2001 From: Qiming-Liu Date: Wed, 6 Jul 2022 13:59:58 +0930 Subject: [PATCH 2/2] feat: hotkey-restart-tab, remove restart menu --- tabby-core/src/components/appRoot.component.ts | 4 ++++ tabby-core/src/configDefaults.linux.yaml | 1 + tabby-core/src/configDefaults.macos.yaml | 1 + tabby-core/src/configDefaults.windows.yaml | 1 + tabby-core/src/hotkeys.ts | 4 ++++ tabby-core/src/tabContextMenu.ts | 11 ----------- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tabby-core/src/components/appRoot.component.ts b/tabby-core/src/components/appRoot.component.ts index 5cbccf1319..30e338f3ef 100644 --- a/tabby-core/src/components/appRoot.component.ts +++ b/tabby-core/src/components/appRoot.component.ts @@ -112,6 +112,10 @@ export class AppRootComponent { if (hotkey === 'duplicate-tab') { this.app.duplicateTab(this.app.activeTab) } + if (hotkey === 'restart-tab') { + this.app.duplicateTab(this.app.activeTab) + this.app.closeTab(this.app.activeTab, true) + } if (hotkey === 'explode-tab' && this.app.activeTab instanceof SplitTabComponent) { this.app.explodeTab(this.app.activeTab) } diff --git a/tabby-core/src/configDefaults.linux.yaml b/tabby-core/src/configDefaults.linux.yaml index cadb416099..4805ce0e73 100644 --- a/tabby-core/src/configDefaults.linux.yaml +++ b/tabby-core/src/configDefaults.linux.yaml @@ -21,6 +21,7 @@ hotkeys: rearrange-panes: - 'Ctrl-Shift' duplicate-tab: [] + restart-tab: [] explode-tab: - 'Ctrl-Shift-.' combine-tabs: diff --git a/tabby-core/src/configDefaults.macos.yaml b/tabby-core/src/configDefaults.macos.yaml index 620471dffb..b1be9458fb 100644 --- a/tabby-core/src/configDefaults.macos.yaml +++ b/tabby-core/src/configDefaults.macos.yaml @@ -39,6 +39,7 @@ hotkeys: tab-10: - '⌘-0' duplicate-tab: [] + restart-tab: [] explode-tab: - '⌘-Shift-.' combine-tabs: diff --git a/tabby-core/src/configDefaults.windows.yaml b/tabby-core/src/configDefaults.windows.yaml index 19293b8793..80bd85ee5e 100644 --- a/tabby-core/src/configDefaults.windows.yaml +++ b/tabby-core/src/configDefaults.windows.yaml @@ -22,6 +22,7 @@ hotkeys: rearrange-panes: - 'Ctrl-Shift' duplicate-tab: [] + restart-tab: [] explode-tab: - 'Ctrl-Shift-.' combine-tabs: diff --git a/tabby-core/src/hotkeys.ts b/tabby-core/src/hotkeys.ts index e35f662f34..c6c15403f0 100644 --- a/tabby-core/src/hotkeys.ts +++ b/tabby-core/src/hotkeys.ts @@ -56,6 +56,10 @@ export class AppHotkeyProvider extends HotkeyProvider { id: 'duplicate-tab', name: this.translate.instant('Duplicate tab'), }, + { + id: 'restart-tab', + name: this.translate.instant('Restart tab'), + }, { id: 'explode-tab', name: this.translate.instant('Turn current tab\'s panes into separate tabs'), diff --git a/tabby-core/src/tabContextMenu.ts b/tabby-core/src/tabContextMenu.ts index 3572239a92..d45b65e07b 100644 --- a/tabby-core/src/tabContextMenu.ts +++ b/tabby-core/src/tabContextMenu.ts @@ -120,17 +120,6 @@ export class CommonOptionsContextMenu extends TabContextMenuItemProvider { label: this.translate.instant('Duplicate'), click: () => this.app.duplicateTab(tab), }, - { - label: this.translate.instant('Restart'), - click: () => { - this.app.duplicateTab(tab) - if (this.app.tabs.includes(tab)) { - this.app.closeTab(tab, true) - } else { - tab.destroy() - } - }, - }, { label: this.translate.instant('Color'), sublabel: currentColor ? this.translate.instant(currentColor) : undefined,