forked from matrix/element-web
Merge pull request #2999 from vector-im/dbkr/carlos22_single_instance
Make riot desktop single instance
This commit is contained in:
commit
693285ac0e
|
@ -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 New Issue