feat: Single instance application behavior

This commit is contained in:
2026-06-16 01:03:02 +07:00
parent ae0e6b3770
commit 8c3ca82a03
+10
View File
@@ -70,6 +70,12 @@ let mainWindow: BrowserWindow | null = null
let tray: Tray | null = null
let quitting = false
const gotSingleInstanceLock = app.requestSingleInstanceLock()
if (!gotSingleInstanceLock) {
app.quit()
}
function shouldStartHidden(): boolean {
if (process.argv.includes('--hidden')) return true
if (process.platform === 'darwin') {
@@ -179,6 +185,10 @@ function updateTrayMenu(status: RelayStatus): void {
tray.setContextMenu(menu)
}
app.on('second-instance', () => {
createWindow()
})
app.whenReady().then(() => {
electronApp.setAppUserModelId('cafe.kirameki.discord-rpc-relay')