mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 14:19:25 +08:00
Fix: Webapp open second-instance , focus current
This commit is contained in:
committed by
anmengweilai
parent
e52f029420
commit
7a5a6112c4
@@ -11,10 +11,20 @@ const isSingleInstance = app.requestSingleInstanceLock();
|
||||
logger.info(`isSingleInstance:${isSingleInstance}`);
|
||||
if (!isSingleInstance) {
|
||||
app.quit();
|
||||
process.exit(0);
|
||||
} else {
|
||||
app.on('second-instance', async () => {
|
||||
logger.info('second-instance');
|
||||
const [curWindow] = BrowserWindow.getAllWindows();
|
||||
if (!curWindow) {
|
||||
logger.info('------createApp------');
|
||||
await createApp();
|
||||
} else {
|
||||
logger.info('------curWindow.focus------');
|
||||
curWindow.focus?.();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Disable Hardware Acceleration to save more system resources.
|
||||
* Also `in-process-gpu` to avoid creating a gpu process which may `exited unexpectedly`
|
||||
|
||||
Reference in New Issue
Block a user