mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 11:49:26 +08:00
Fix: Webapp second-instance
This commit is contained in:
@@ -1,26 +1,19 @@
|
||||
import {app, BrowserWindow} from 'electron';
|
||||
import './security-restrictions';
|
||||
import {createApp} from '/@/createApp';
|
||||
// import {join} from 'path';
|
||||
import logger from '/@/logger';
|
||||
import {createMainWindow} from '/@/createMainWindow';
|
||||
import {noSandbox} from '/@/config';
|
||||
// import {restoreWindow} from "/@/mainWindow";
|
||||
|
||||
/**
|
||||
* Prevent electron from running multiple instances.
|
||||
*/
|
||||
const isSingleInstance = app.requestSingleInstanceLock();
|
||||
logger.info(`isSingleInstance:${isSingleInstance}`);
|
||||
if (!isSingleInstance) {
|
||||
app.quit();
|
||||
process.exit(0);
|
||||
}
|
||||
app.on('second-instance', async () => {
|
||||
logger.info('second-instance');
|
||||
const win = await createMainWindow();
|
||||
if (win?.isMinimized()) win?.restore();
|
||||
win?.focus();
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Disable Hardware Acceleration to save more system resources.
|
||||
|
||||
Reference in New Issue
Block a user