Quellcode durchsuchen

feat: add disconnect tab hotkey

Clem Fern vor 2 Jahren
Ursprung
Commit
7f2340e701

+ 1 - 0
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:

+ 1 - 0
tabby-core/src/configDefaults.macos.yaml

@@ -40,6 +40,7 @@ hotkeys:
   duplicate-tab: []
   restart-tab: []
   reconnect-tab: []
+  disconnect-tab: []
   explode-tab:
     - '⌘-Shift-.'
   combine-tabs:

+ 1 - 0
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:

+ 13 - 2
tabby-terminal/src/api/connectableTerminalTab.component.ts

@@ -22,8 +22,19 @@ export abstract class ConnectableTerminalTabComponent<P extends BaseTerminalProf
         super(injector)
 
         this.subscribeUntilDestroyed(this.hotkeys.hotkey$, hotkey => {
-            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
             }
         })
     }

+ 4 - 0
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() }