From 0ea2adf6c8026eeaa13da59f5ba1cd96f50a4e02 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Tue, 25 Oct 2022 21:49:54 +0200 Subject: [PATCH] fixed #3862 - option to close the window when closing all tabs --- tabby-core/src/configDefaults.yaml | 1 + tabby-core/src/services/app.service.ts | 6 ++++++ .../src/components/windowSettingsTab.component.pug | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/tabby-core/src/configDefaults.yaml b/tabby-core/src/configDefaults.yaml index a4cd8be9..8a2bbf02 100644 --- a/tabby-core/src/configDefaults.yaml +++ b/tabby-core/src/configDefaults.yaml @@ -16,6 +16,7 @@ appearance: opacity: 1.0 vibrancy: false vibrancyType: 'blur' + lastTabClosesWindow: false terminal: showBuiltinProfiles: true showRecentProfiles: 3 diff --git a/tabby-core/src/services/app.service.ts b/tabby-core/src/services/app.service.ts index 324e8574..ab4786ab 100644 --- a/tabby-core/src/services/app.service.ts +++ b/tabby-core/src/services/app.service.ts @@ -107,6 +107,12 @@ export class AppService { } }) + this.tabClosed$.subscribe(() => { + if (!this.tabs.length && this.config.store.appearance.lastTabClosesWindow) { + this.hostWindow.close() + } + }) + hostWindow.windowFocused$.subscribe(() => this._activeTab?.emitFocused()) } diff --git a/tabby-settings/src/components/windowSettingsTab.component.pug b/tabby-settings/src/components/windowSettingsTab.component.pug index bf46bacf..393c8016 100644 --- a/tabby-settings/src/components/windowSettingsTab.component.pug +++ b/tabby-settings/src/components/windowSettingsTab.component.pug @@ -313,6 +313,15 @@ h3.mt-4(translate) Tabs (ngModelChange)='config.save();', ) +.form-line + .header + .title(translate) Close the window after closing the last tab + + toggle( + [(ngModel)]='config.store.appearance.lastTabClosesWindow', + (ngModelChange)='config.save();', + ) + h3.mt-4(translate) Panes .form-line()