Add option to disable tab restore on startup

This commit is contained in:
Chris Kaczor 2019-10-14 17:14:23 -04:00
parent 607ea4b549
commit db86150832
3 changed files with 29 additions and 10 deletions

View File

@ -71,20 +71,29 @@ export class AppService {
private tabsService: TabsService,
) {
if (hostApp.getWindow().id === 1) {
this.tabRecovery.recoverTabs().then(tabs => {
for (const tab of tabs) {
this.openNewTabRaw(tab.type, tab.options)
}
this.tabsChanged$.subscribe(() => {
tabRecovery.saveTabs(this.tabs)
if (config.store.terminal.recoverTabs) {
this.tabRecovery.recoverTabs().then(tabs => {
for (const tab of tabs) {
this.openNewTabRaw(tab.type, tab.options)
}
this.startTabStorage()
})
setInterval(() => {
tabRecovery.saveTabs(this.tabs)
}, 30000)
})
} else {
/** Continue to store the tabs even if the setting is currently off */
this.startTabStorage()
}
}
}
startTabStorage() {
this.tabsChanged$.subscribe(() => {
this.tabRecovery.saveTabs(this.tabs)
})
setInterval(() => {
this.tabRecovery.saveTabs(this.tabs)
}, 30000)
}
addTabRaw (tab: BaseTabComponent) {
this.tabs.push(tab)
this.selectTab(tab)

View File

@ -66,6 +66,15 @@ h3.mb-3 Terminal
(ngModelChange)='config.save()',
)
.form-line
.header
.title Restore terminal tabs on app start
toggle(
[(ngModel)]='config.store.terminal.recoverTabs',
(ngModelChange)='config.save()',
)
.form-line
.header
.title Bracketed paste (requires shell support)

View File

@ -59,6 +59,7 @@ export class TerminalConfigProvider extends ConfigProvider {
environment: {},
profiles: [],
useConPTY: true,
recoverTabs: true,
},
}