【发布时间】:2024-01-09 06:49:01
【问题描述】:
我有一个电子应用程序,它只会包装一个远程页面,同时添加一些额外的功能。使用以下代码,页面加载并工作。当远程页面使用通知 API 触发一些通知时,这些通知会在电子应用程序最小化时显示。我的问题是,当单击这些通知时,应用程序不会像直接在任何其他浏览器上打开远程页面时那样被放在前面。我只能针对 Ubuntu 19.10 Linux (Gnome 3) 进行测试。
知道我是否需要为此配置一些东西,或者这是否是 Electron/Ubuntu/Gnome 的错误?
const {app, shell, BrowserWindow} = require('electron');
let mainWindow;
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 1024,
height: 786,
});
mainWindow.setMenu(null);
mainWindow.setTitle('My app – Connecting…');
mainWindow.loadURL('https://some.url.somwhere');
// Emitted when the window is closed.
mainWindow.on('closed', () => {
mainWindow = null
})
}
app.on('ready', createWindow);
【问题讨论】: