From ae06bcfc5f8833c96feba5e9da7da0f20598d15b Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Thu, 2 Dec 2021 23:55:20 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=85=B3=E9=97=AD=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/config.js | 4 ++++ packages/gui/src/background.js | 4 ++++ packages/gui/src/bridge/on-close/front.js | 2 +- packages/gui/src/view/pages/setting.vue | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/core/src/config.js b/packages/core/src/config.js index 42eeebb..6a067d6 100644 --- a/packages/core/src/config.js +++ b/packages/core/src/config.js @@ -172,6 +172,10 @@ const configApi = { const config = configApi.get() return config || {} }, + update (partConfig) { + const newConfig = lodash.merge(configApi.get(), partConfig) + configApi.save(newConfig) + }, get, set (newConfig) { if (newConfig == null) { diff --git a/packages/gui/src/background.js b/packages/gui/src/background.js index 93481b7..20b48cd 100644 --- a/packages/gui/src/background.js +++ b/packages/gui/src/background.js @@ -186,6 +186,10 @@ function createWindow (startHideWindow) { return } e.preventDefault() + if (isLinux()) { + quit(app) + return + } const config = DevSidecar.api.config.get() const closeStrategy = config.app.closeStrategy if (closeStrategy === 0) { diff --git a/packages/gui/src/bridge/on-close/front.js b/packages/gui/src/bridge/on-close/front.js index 28bddfc..789c6f7 100644 --- a/packages/gui/src/bridge/on-close/front.js +++ b/packages/gui/src/bridge/on-close/front.js @@ -33,7 +33,7 @@ function install (app, api) { async onOk () { console.log('OK') if (result.save) { - await api.config.save({ app: { closeStrategy: result.closeType } }) + await api.config.update({ app: { closeStrategy: result.closeType } }) } api.ipc.send('close', { key: 'selected', value: result.closeType }) }, diff --git a/packages/gui/src/view/pages/setting.vue b/packages/gui/src/view/pages/setting.vue index 6ece805..2222c99 100644 --- a/packages/gui/src/view/pages/setting.vue +++ b/packages/gui/src/view/pages/setting.vue @@ -35,7 +35,7 @@ - +