fix(desktop): clean single-instance lock exit and suppress devtools console crash
Some checks are pending
deploy-site-windows / deploy-win (push) Waiting to run
deploy-site / deploy (push) Waiting to run

This commit is contained in:
Yun Chan 2026-08-20 22:48:58 +09:00
parent 0dc6a1dc93
commit eedbe97d02
3 changed files with 18 additions and 13 deletions

View file

@ -131,15 +131,24 @@ async function handleDeepLink(url: string): Promise<void> {
const gotTheLock = process.env.NODE_ENV === 'test' ? true : app.requestSingleInstanceLock()
if (!gotTheLock) {
app.quit()
console.log('[D3RO Voice] Another instance is already running. Existing window focused.')
app.exit(0)
} else {
app.on('second-instance', (_event, argv) => {
// 기존 인스턴스의 메인 윈도우를 활성화
// 기존 인스턴스의 메인 윈도우를 최상위로 활성화
const mainWindow = getMainWindow()
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore()
mainWindow.show()
mainWindow.focus()
mainWindow.setAlwaysOnTop(true)
setTimeout(() => {
try {
mainWindow?.setAlwaysOnTop(false)
} catch {
// ignore
}
}, 500)
}
// Windows: deep link는 두 번째 인스턴스의 argv 마지막 인자로 들어옴
const deepLinkArg = argv.find((a) => a.startsWith(`${PROTOCOL}://`))

View file

@ -115,7 +115,7 @@ export function createMainWindow(): BrowserWindow {
mainWindow?.restore()
mainWindow?.focus()
mainWindow?.flashFrame(true)
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
if (is.dev && process.env['ELECTRON_OPEN_DEVTOOLS'] === '1') {
mainWindow?.webContents.openDevTools({ mode: 'right' })
}
logger.info('Main window shown')