当电子的窗口隐藏时如何激活另一个应用程序窗口

How to active another application window when electron's window hide

本文关键字:窗口 激活 应用程序 另一个 何激活 隐藏      更新时间:2023-10-16

当我的电子应用程序称为win.hide((时,我有一个情况,我希望最新的应用程序因为显示我的电子的应用程序而变得模糊。

我在 electron 的 GitHub 上看到了一些问题,它被标记为错误,但仍未修复。 https://github.com/electron/electron/issues/10023

是否有一些解决方案或想法可以实现它?

我无法在Linux上重现这一点。但是,作为一种省力的解决方法,您可以执行以下操作:

const {app, BrowserWindow} = require('electron');
BrowserWindow.prototype.my_hide = function() {
this.blur();
this.hide();     
return;
};
let window = null;
window = new BrowserWindow({...init...});
//at a point where you want to blur and hide your window
window.my_hide();