From be9f15dc45df2173b015de5f3a0f638915af2d0b Mon Sep 17 00:00:00 2001 From: CanadaHonk Date: Mon, 3 Apr 2023 17:40:02 +0100 Subject: [PATCH] config: show existing window if already open --- src/config/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/config/index.js b/src/config/index.js index 55dfe44..cbce815 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -4,12 +4,19 @@ ipcMain.on('DISCORD_UPDATED_QUOTES', (e, c) => { if (c === 'o') exports.open(); }); +let win; exports.open = () => { - const win = require('../utils/win')({ + if (win) return win.show(); + + win = require('../utils/win')({ width: 500, height: 650 }, 'config'); + win.on('close', () => { + win = null; + }); + let config = settings.get('openasar', {}); config.setup = true; settings.set('openasar', config); @@ -33,5 +40,5 @@ exports.open = () => { ipcMain.on('of', () => { shell.openPath(require('../paths').getUserData() + '/settings.json') - }) + }); };