mirror of
https://github.com/vector-im/element-web.git
synced 2024-09-09 22:55:12 +00:00
Merge pull request #2999 from vector-im/dbkr/carlos22_single_instance
Make riot desktop single instance
This commit is contained in:
commit
693285ac0e
1 changed files with 13 additions and 0 deletions
|
@ -161,6 +161,19 @@ electron.ipcMain.on('install_update', installUpdate);
|
|||
|
||||
electron.app.commandLine.appendSwitch('--enable-usermedia-screen-capturing');
|
||||
|
||||
const shouldQuit = electron.app.makeSingleInstance((commandLine, workingDirectory) => {
|
||||
// Someone tried to run a second instance, we should focus our window.
|
||||
if (mainWindow) {
|
||||
if (!mainWindow.isVisible()) mainWindow.show();
|
||||
if (mainWindow.isMinimized()) mainWindow.restore();
|
||||
mainWindow.focus();
|
||||
}
|
||||
});
|
||||
|
||||
if (shouldQuit) {
|
||||
electron.app.quit()
|
||||
}
|
||||
|
||||
electron.app.on('ready', () => {
|
||||
if (vectorConfig.update_base_url) {
|
||||
console.log("Starting auto update with base URL: " + vectorConfig.update_base_url);
|
||||
|
|
Loading…
Reference in a new issue