From c31290ee0d67ae14889644b61117262490f7757f Mon Sep 17 00:00:00 2001 From: muwoo <2424880409@qq.com> Date: Thu, 15 Jul 2021 11:50:53 +0800 Subject: [PATCH] =?UTF-8?q?ref:=20=E6=94=AF=E6=8C=81=E4=B8=BB=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E5=A4=9Adesktop=E5=9C=A8=E5=BA=94=E7=94=A8=E4=B8=8A?= =?UTF-8?q?=E5=94=A4=E8=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/main/browsers/superPanel.js | 1 - src/main/common/common.js | 9 +++++++++ src/renderer/pages/search/subpages/market.vue | 9 ++++++++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 2599eb4..b72e72e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rubick2", - "version": "0.0.1", + "version": "0.0.2", "author": "muwoo <2424880409@qq.com>", "description": "An electron-vue project", "license": null, diff --git a/src/main/browsers/superPanel.js b/src/main/browsers/superPanel.js index 6113bcd..967c6bd 100644 --- a/src/main/browsers/superPanel.js +++ b/src/main/browsers/superPanel.js @@ -35,7 +35,6 @@ module.exports = () => { }, }); win.loadURL(`file://${__static}/plugins/superPanel/index.html`); - win.once('ready-to-show', () => win.show()); win.on("closed", () => { win = undefined; }); diff --git a/src/main/common/common.js b/src/main/common/common.js index c1e246f..fd65897 100644 --- a/src/main/common/common.js +++ b/src/main/common/common.js @@ -5,6 +5,7 @@ import { clipboard, Notification, app, + screen, } from 'electron'; import Api from './api'; import robot from 'robotjs'; @@ -28,6 +29,14 @@ function registerShortCut(mainWindow) { globalShortcut.unregisterAll(); // 注册偏好快捷键 globalShortcut.register(config.perf.shortCut.showAndHidden, () => { + const {x, y} = screen.getCursorScreenPoint(); + const currentDisplay = screen.getDisplayNearestPoint({ x, y }); + const wx = parseInt(currentDisplay.workArea.x + currentDisplay.workArea.width / 2 - 400); + const wy = parseInt(currentDisplay.workArea.y + currentDisplay.workArea.height / 2 - 200); + mainWindow.setVisibleOnAllWorkspaces(true); + mainWindow.focus(); + mainWindow.setVisibleOnAllWorkspaces(false); + mainWindow.setPosition(wx, wy); mainWindow.show(); }); diff --git a/src/renderer/pages/search/subpages/market.vue b/src/renderer/pages/search/subpages/market.vue index 671d6fc..efd9ca0 100644 --- a/src/renderer/pages/search/subpages/market.vue +++ b/src/renderer/pages/search/subpages/market.vue @@ -26,6 +26,7 @@
{{ item.pluginName }}
@@ -48,7 +49,9 @@ export default { return { pluginList: [], loading: {}, - bannerList: [] + bannerList: [], + show: false, + currentSelect: {} } }, async created() { @@ -75,6 +78,10 @@ export default { showButton(item) { return !this.devPlugins.filter(plugin => (plugin.name === item.name && plugin.type === 'prod')).length; }, + showPannel(item) { + this.show = true; + this.currentSelect = item; + }, ...mapActions('main', ['downloadPlugin']) }, computed: {