Skip to content

Commit

Permalink
feat: add disconnect tab hotkey
Browse files Browse the repository at this point in the history
  • Loading branch information
Clem-Fern committed Jun 15, 2023
1 parent b0350b6 commit 7f2340e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions tabby-core/src/configDefaults.linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ hotkeys:
duplicate-tab: []
restart-tab: []
reconnect-tab: []
disconnect-tab: []
explode-tab:
- 'Ctrl-Shift-.'
combine-tabs:
Expand Down
1 change: 1 addition & 0 deletions tabby-core/src/configDefaults.macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ hotkeys:
duplicate-tab: []
restart-tab: []
reconnect-tab: []
disconnect-tab: []
explode-tab:
- '⌘-Shift-.'
combine-tabs:
Expand Down
1 change: 1 addition & 0 deletions tabby-core/src/configDefaults.windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ hotkeys:
duplicate-tab: []
restart-tab: []
reconnect-tab: []
disconnect-tab: []
explode-tab:
- 'Ctrl-Shift-.'
combine-tabs:
Expand Down
15 changes: 13 additions & 2 deletions tabby-terminal/src/api/connectableTerminalTab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
})
}
Expand Down
4 changes: 4 additions & 0 deletions tabby-terminal/src/hotkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
Expand Down

0 comments on commit 7f2340e

Please sign in to comment.