mirror of
https://github.com/rubickCenter/rubick
synced 2025-12-29 22:39:45 +08:00
ref: 支持主窗口多desktop在应用上唤起
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user