mirror of
https://github.com/rubickCenter/rubick
synced 2026-02-25 08:21:21 +08:00
Merge pull request #488 from lanxiuyun/fixWindows
fix:当Windows隐藏窗口后,不会自动将焦点返回到之前的程序。
This commit is contained in:
@@ -61,7 +61,11 @@ const registerHotKey = (mainWindow: BrowserWindow): void => {
|
|||||||
// 显示主窗口
|
// 显示主窗口
|
||||||
function mainWindowPopUp() {
|
function mainWindowPopUp() {
|
||||||
const currentShow = mainWindow.isVisible() && mainWindow.isFocused();
|
const currentShow = mainWindow.isVisible() && mainWindow.isFocused();
|
||||||
if (currentShow) return mainWindow.hide();
|
if (currentShow) {
|
||||||
|
mainWindow.blur(); // 先失去焦点,使焦点恢复到之前的应用程序
|
||||||
|
mainWindow.hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
const { x: wx, y: wy } = winPosition.getPosition();
|
const { x: wx, y: wy } = winPosition.getPosition();
|
||||||
mainWindow.setAlwaysOnTop(false);
|
mainWindow.setAlwaysOnTop(false);
|
||||||
mainWindow.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true });
|
mainWindow.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true });
|
||||||
|
|||||||
Reference in New Issue
Block a user