From 7f2340e70147925492c738ccfa85e977a7cbb50e Mon Sep 17 00:00:00 2001 From: Clem Fern Date: Thu, 15 Jun 2023 21:34:41 +0200 Subject: [PATCH] feat: add disconnect tab hotkey --- tabby-core/src/configDefaults.linux.yaml | 1 + tabby-core/src/configDefaults.macos.yaml | 1 + tabby-core/src/configDefaults.windows.yaml | 1 + .../src/api/connectableTerminalTab.component.ts | 15 +++++++++++++-- tabby-terminal/src/hotkeys.ts | 4 ++++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tabby-core/src/configDefaults.linux.yaml b/tabby-core/src/configDefaults.linux.yaml index 1d213e10f9..dc150aff1a 100644 --- a/tabby-core/src/configDefaults.linux.yaml +++ b/tabby-core/src/configDefaults.linux.yaml @@ -23,6 +23,7 @@ hotkeys: duplicate-tab: [] restart-tab: [] reconnect-tab: [] + disconnect-tab: [] explode-tab: - 'Ctrl-Shift-.' combine-tabs: diff --git a/tabby-core/src/configDefaults.macos.yaml b/tabby-core/src/configDefaults.macos.yaml index d47050c4f8..6f22f2ac5e 100644 --- a/tabby-core/src/configDefaults.macos.yaml +++ b/tabby-core/src/configDefaults.macos.yaml @@ -40,6 +40,7 @@ hotkeys: duplicate-tab: [] restart-tab: [] reconnect-tab: [] + disconnect-tab: [] explode-tab: - '⌘-Shift-.' combine-tabs: diff --git a/tabby-core/src/configDefaults.windows.yaml b/tabby-core/src/configDefaults.windows.yaml index 58870f8e07..2fe150a1ff 100644 --- a/tabby-core/src/configDefaults.windows.yaml +++ b/tabby-core/src/configDefaults.windows.yaml @@ -24,6 +24,7 @@ hotkeys: duplicate-tab: [] restart-tab: [] reconnect-tab: [] + disconnect-tab: [] explode-tab: - 'Ctrl-Shift-.' combine-tabs: diff --git a/tabby-terminal/src/api/connectableTerminalTab.component.ts b/tabby-terminal/src/api/connectableTerminalTab.component.ts index e54451ddf0..837bd5ed57 100644 --- a/tabby-terminal/src/api/connectableTerminalTab.component.ts +++ b/tabby-terminal/src/api/connectableTerminalTab.component.ts @@ -22,8 +22,19 @@ export abstract class ConnectableTerminalTabComponent

{ - if (this.hasFocus && hotkey === 'reconnect-tab') { - this.reconnect() + if (!this.hasFocus) { + return + } + + switch (hotkey) { + case 'reconnect-tab': + this.reconnect() + this.notifications.notice(this.translate.instant('Reconnect')) + break + case 'disconnect-tab': + this.disconnect() + this.notifications.notice(this.translate.instant('Disconnect')) + break } }) } diff --git a/tabby-terminal/src/hotkeys.ts b/tabby-terminal/src/hotkeys.ts index 08c69798ec..98974acf90 100644 --- a/tabby-terminal/src/hotkeys.ts +++ b/tabby-terminal/src/hotkeys.ts @@ -101,6 +101,10 @@ export class TerminalHotkeyProvider extends HotkeyProvider { id: 'reconnect-tab', name: this.translate.instant('Reconnect current tab (Serial/Telnet/SSH)'), }, + { + id: 'disconnect-tab', + name: this.translate.instant('Disconnect current tab (Serial/Telnet/SSH)'), + }, ] constructor (private translate: TranslateService) { super() }