mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
Fix app single instance lock (#385)
This commit is contained in:
parent
48a529dd51
commit
fdfbad68e2
1 changed files with 40 additions and 34 deletions
|
|
@ -84,16 +84,6 @@ const installExtensions = async () => {
|
||||||
.catch(console.log);
|
.catch(console.log);
|
||||||
};
|
};
|
||||||
|
|
||||||
const singleInstance = app.requestSingleInstanceLock();
|
|
||||||
|
|
||||||
if (!singleInstance) {
|
|
||||||
app.quit();
|
|
||||||
} else {
|
|
||||||
app.on('second-instance', () => {
|
|
||||||
mainWindow?.show();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const RESOURCES_PATH = app.isPackaged
|
const RESOURCES_PATH = app.isPackaged
|
||||||
? path.join(process.resourcesPath, 'assets')
|
? path.join(process.resourcesPath, 'assets')
|
||||||
: path.join(__dirname, '../../assets');
|
: path.join(__dirname, '../../assets');
|
||||||
|
|
@ -666,7 +656,22 @@ const FONT_HEADERS = [
|
||||||
'font/woff2',
|
'font/woff2',
|
||||||
];
|
];
|
||||||
|
|
||||||
app.whenReady()
|
const singleInstance = app.requestSingleInstanceLock();
|
||||||
|
|
||||||
|
if (!singleInstance) {
|
||||||
|
app.quit();
|
||||||
|
} else {
|
||||||
|
app.on('second-instance', () => {
|
||||||
|
if (mainWindow) {
|
||||||
|
if (mainWindow.isMinimized()) {
|
||||||
|
mainWindow.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
mainWindow.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
app.whenReady()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
protocol.handle('feishin', async (request) => {
|
protocol.handle('feishin', async (request) => {
|
||||||
const filePath = `file://${request.url.slice('feishin://'.length)}`;
|
const filePath = `file://${request.url.slice('feishin://'.length)}`;
|
||||||
|
|
@ -694,3 +699,4 @@ app.whenReady()
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(console.log);
|
.catch(console.log);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue