mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
Add single-instance
This commit is contained in:
parent
b5e7e94ba7
commit
7e9e43fa6a
1 changed files with 12 additions and 0 deletions
|
@ -54,7 +54,19 @@ async function doAfterDefiningTheWindow() {
|
|||
}
|
||||
mainWindow.webContents.userAgent = `Mozilla/5.0 (X11; ${osType} ${os.arch()}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36`; //fake useragent for screenshare to work
|
||||
}
|
||||
const gotTheLock = app.requestSingleInstanceLock()
|
||||
|
||||
if (!gotTheLock) {
|
||||
app.quit()
|
||||
} else {
|
||||
app.on('second-instance', (event, commandLine, workingDirectory) => {
|
||||
// i love stack overflow
|
||||
if (mainWindow) {
|
||||
mainWindow.restore()
|
||||
mainWindow.focus()
|
||||
}
|
||||
})
|
||||
}
|
||||
mainWindow.webContents.setWindowOpenHandler(({url}) => {
|
||||
if (url.startsWith("https:" || url.startsWith("http:") || url.startsWith("mailto:"))) {
|
||||
shell.openExternal(url);
|
||||
|
|
Loading…
Reference in a new issue