From 83ab3c6db7a5cf8274c217a9ef8984ea51077358 Mon Sep 17 00:00:00 2001 From: PiEgg Date: Fri, 12 Aug 2022 17:06:29 +0800 Subject: [PATCH] :sparkles: Feature: tray-window add open-setting-window button --- src/main/events/picgoCoreIPC.ts | 13 ++++++++- src/renderer/pages/TrayPage.vue | 43 +++++++++++++++++++++--------- src/renderer/utils/mainMixin.ts | 4 +++ src/universal/events/constants.ts | 1 + src/universal/types/extra-vue.d.ts | 1 + 5 files changed, 48 insertions(+), 14 deletions(-) diff --git a/src/main/events/picgoCoreIPC.ts b/src/main/events/picgoCoreIPC.ts index 2443948..168b799 100644 --- a/src/main/events/picgoCoreIPC.ts +++ b/src/main/events/picgoCoreIPC.ts @@ -25,7 +25,8 @@ import { PICGO_GET_BY_ID_DB, PICGO_REMOVE_BY_ID_DB, PICGO_OPEN_FILE, - PASTE_TEXT + PASTE_TEXT, + OPEN_WINDOW } from '#/events/constants' import { GalleryDB } from 'apis/core/datastore' @@ -356,6 +357,15 @@ const handleOpenFile = () => { }) } +const handleOpenWindow = () => { + ipcMain.on(OPEN_WINDOW, (event: IpcMainEvent, windowName: IWindowList) => { + const window = windowManager.get(windowName) + if (window) { + window.show() + } + }) +} + export default { listen () { handleGetPluginList() @@ -368,6 +378,7 @@ export default { handlePicGoGalleryDB() handleImportLocalPlugin() handleOpenFile() + handleOpenWindow() }, // TODO: separate to single file handlePluginUninstall, diff --git a/src/renderer/pages/TrayPage.vue b/src/renderer/pages/TrayPage.vue index 7c09842..c1bbec9 100644 --- a/src/renderer/pages/TrayPage.vue +++ b/src/renderer/pages/TrayPage.vue @@ -1,6 +1,6 @@