mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-19 18:07:58 +00:00
resolves Eugeny/tabby#7751, Eugeny/tabby#8062, Eugeny/tabby#6617 add configurable behavior when session ends
This commit is contained in:
@@ -82,12 +82,25 @@ export class SerialTabComponent extends BaseTerminalTabComponent<SerialProfile>
|
||||
this.session?.resize(this.size.columns, this.size.rows)
|
||||
})
|
||||
this.attachSessionHandler(this.session!.destroyed$, () => {
|
||||
this.write(this.translate.instant(_('Press any key to reconnect')) + '\r\n')
|
||||
this.input$.pipe(first()).subscribe(() => {
|
||||
if (!this.session?.open) {
|
||||
if (this.frontend) {
|
||||
// Session was closed abruptly
|
||||
if (this.config.store.terminal.behaviorOnSessionEnds == 'close') {
|
||||
// Close the tab
|
||||
this.destroy()
|
||||
} else if (this.config.store.terminal.behaviorOnSessionEnds.startsWith('reconnect-or-')) {
|
||||
// Automatically reconnect the session
|
||||
this.reconnect()
|
||||
} else {
|
||||
// Reconnect Offer
|
||||
this.write(this.translate.instant(_('Press any key to reconnect')) + '\r\n')
|
||||
this.input$.pipe(first()).subscribe(() => {
|
||||
if (!this.session?.open) {
|
||||
this.reconnect()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
super.attachSessionHandlers()
|
||||
}
|
||||
|
Reference in New Issue
Block a user