mirror of
https://github.com/YuzuZensai/Discord-Presence-Relay.git
synced 2026-09-13 10:49:02 +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 tray: Tray | null = null
|
||||||
let quitting = false
|
let quitting = false
|
||||||
|
|
||||||
|
const gotSingleInstanceLock = app.requestSingleInstanceLock()
|
||||||
|
|
||||||
|
if (!gotSingleInstanceLock) {
|
||||||
|
app.quit()
|
||||||
|
}
|
||||||
|
|
||||||
function shouldStartHidden(): boolean {
|
function shouldStartHidden(): boolean {
|
||||||
if (process.argv.includes('--hidden')) return true
|
if (process.argv.includes('--hidden')) return true
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
@@ -179,6 +185,10 @@ function updateTrayMenu(status: RelayStatus): void {
|
|||||||
tray.setContextMenu(menu)
|
tray.setContextMenu(menu)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.on('second-instance', () => {
|
||||||
|
createWindow()
|
||||||
|
})
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
electronApp.setAppUserModelId('cafe.kirameki.discord-rpc-relay')
|
electronApp.setAppUserModelId('cafe.kirameki.discord-rpc-relay')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user