diff --git a/app/main/index.ts b/app/main/index.ts index 1e6aac78..6f74d5a5 100644 --- a/app/main/index.ts +++ b/app/main/index.ts @@ -94,6 +94,9 @@ function createMainWindow(): Electron.BrowserWindow { // Keep the app running in background on close event win.on('close', e => { + if (ConfigUtil.getConfigItem("quitOnClose")) { + app.quit(); + } if (!isQuitting) { e.preventDefault(); diff --git a/app/renderer/js/main.ts b/app/renderer/js/main.ts index a3f3d66a..37b2a202 100644 --- a/app/renderer/js/main.ts +++ b/app/renderer/js/main.ts @@ -58,6 +58,7 @@ interface SettingsOptions { }; downloadsPath: string; showDownloadFolder: boolean; + quitOnClose: boolean; flashTaskbarOnMessage?: boolean; dockBouncing?: boolean; loading?: AnyObject; @@ -206,7 +207,8 @@ class ServerManagerView { silent: false }, downloadsPath: `${app.getPath('downloads')}`, - showDownloadFolder: false + showDownloadFolder: false, + quitOnClose: false }; // Platform specific settings diff --git a/app/renderer/js/pages/preference/general-section.ts b/app/renderer/js/pages/preference/general-section.ts index 991ebf85..5ae634a1 100644 --- a/app/renderer/js/pages/preference/general-section.ts +++ b/app/renderer/js/pages/preference/general-section.ts @@ -82,6 +82,10 @@ class GeneralSection extends BaseSection {
${t.__('Always start minimized')}
+
+
${t.__('Quit when the window is closed')}
+
+
${t.__('Enable spellchecker (requires restart)')}
@@ -155,6 +159,7 @@ class GeneralSection extends BaseSection { this.removeCustomCSS(); this.downloadFolder(); this.showDownloadFolder(); + this.updateQuitOnCloseOption(); this.enableErrorReporting(); // Platform specific settings @@ -321,6 +326,18 @@ class GeneralSection extends BaseSection { }); } + updateQuitOnCloseOption(): void { + this.generateSettingOption({ + $element: document.querySelector('#quitOnClose-option .setting-control'), + value: ConfigUtil.getConfigItem('quitOnClose', false), + clickHandler: () => { + const newValue = !ConfigUtil.getConfigItem('quitOnClose'); + ConfigUtil.setConfigItem('quitOnClose', newValue); + this.updateQuitOnCloseOption(); + } + }); + } + enableSpellchecker(): void { this.generateSettingOption({ $element: document.querySelector('#enable-spellchecker-option .setting-control'), diff --git a/app/translations/en.json b/app/translations/en.json index f3a2fe59..a1b1f580 100644 --- a/app/translations/en.json +++ b/app/translations/en.json @@ -113,5 +113,6 @@ "Zoom Out": "Zoom Out", "Zulip Help": "Zulip Help", "keyboard shortcuts": "keyboard shortcuts", - "script": "script" + "script": "script", + "Quit when the window is closed": "Quit when the window is closed" }