mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-04 22:13:13 +00:00
Added option to quit on closing the window.
This adds a configuration option to quit the app (rather than going to the tray) when the "close" button is clicked.
This commit is contained in:
committed by
Akash Nimare
parent
1da6e5d51d
commit
eb1be7106b
@@ -94,6 +94,9 @@ function createMainWindow(): Electron.BrowserWindow {
|
|||||||
|
|
||||||
// Keep the app running in background on close event
|
// Keep the app running in background on close event
|
||||||
win.on('close', e => {
|
win.on('close', e => {
|
||||||
|
if (ConfigUtil.getConfigItem("quitOnClose")) {
|
||||||
|
app.quit();
|
||||||
|
}
|
||||||
if (!isQuitting) {
|
if (!isQuitting) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ interface SettingsOptions {
|
|||||||
};
|
};
|
||||||
downloadsPath: string;
|
downloadsPath: string;
|
||||||
showDownloadFolder: boolean;
|
showDownloadFolder: boolean;
|
||||||
|
quitOnClose: boolean;
|
||||||
flashTaskbarOnMessage?: boolean;
|
flashTaskbarOnMessage?: boolean;
|
||||||
dockBouncing?: boolean;
|
dockBouncing?: boolean;
|
||||||
loading?: AnyObject;
|
loading?: AnyObject;
|
||||||
@@ -206,7 +207,8 @@ class ServerManagerView {
|
|||||||
silent: false
|
silent: false
|
||||||
},
|
},
|
||||||
downloadsPath: `${app.getPath('downloads')}`,
|
downloadsPath: `${app.getPath('downloads')}`,
|
||||||
showDownloadFolder: false
|
showDownloadFolder: false,
|
||||||
|
quitOnClose: false
|
||||||
};
|
};
|
||||||
|
|
||||||
// Platform specific settings
|
// Platform specific settings
|
||||||
|
|||||||
@@ -82,6 +82,10 @@ class GeneralSection extends BaseSection {
|
|||||||
<div class="setting-description">${t.__('Always start minimized')}</div>
|
<div class="setting-description">${t.__('Always start minimized')}</div>
|
||||||
<div class="setting-control"></div>
|
<div class="setting-control"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="setting-row" id="quitOnClose-option">
|
||||||
|
<div class="setting-description">${t.__('Quit when the window is closed')}</div>
|
||||||
|
<div class="setting-control"></div>
|
||||||
|
</div>
|
||||||
<div class="setting-row" id="enable-spellchecker-option">
|
<div class="setting-row" id="enable-spellchecker-option">
|
||||||
<div class="setting-description">${t.__('Enable spellchecker (requires restart)')}</div>
|
<div class="setting-description">${t.__('Enable spellchecker (requires restart)')}</div>
|
||||||
<div class="setting-control"></div>
|
<div class="setting-control"></div>
|
||||||
@@ -155,6 +159,7 @@ class GeneralSection extends BaseSection {
|
|||||||
this.removeCustomCSS();
|
this.removeCustomCSS();
|
||||||
this.downloadFolder();
|
this.downloadFolder();
|
||||||
this.showDownloadFolder();
|
this.showDownloadFolder();
|
||||||
|
this.updateQuitOnCloseOption();
|
||||||
this.enableErrorReporting();
|
this.enableErrorReporting();
|
||||||
|
|
||||||
// Platform specific settings
|
// 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 {
|
enableSpellchecker(): void {
|
||||||
this.generateSettingOption({
|
this.generateSettingOption({
|
||||||
$element: document.querySelector('#enable-spellchecker-option .setting-control'),
|
$element: document.querySelector('#enable-spellchecker-option .setting-control'),
|
||||||
|
|||||||
@@ -113,5 +113,6 @@
|
|||||||
"Zoom Out": "Zoom Out",
|
"Zoom Out": "Zoom Out",
|
||||||
"Zulip Help": "Zulip Help",
|
"Zulip Help": "Zulip Help",
|
||||||
"keyboard shortcuts": "keyboard shortcuts",
|
"keyboard shortcuts": "keyboard shortcuts",
|
||||||
"script": "script"
|
"script": "script",
|
||||||
|
"Quit when the window is closed": "Quit when the window is closed"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user