mirror of
https://github.com/YuzuZensai/Discord-Presence-Relay.git
synced 2026-09-13 17:01:36 +00:00
✨ feat: Single instance application behavior
This commit is contained in:
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user