Electron 使用托盘图标重新激活电子应用程序窗口

Electron 使用托盘图标重新激活电子应用程序窗口,electron,Electron,当我们最小化应用程序时,如何使用托盘菜单调整窗口 const tray = new Tray(path.join(__dirname, '/assets/icons/commusoft-squarelogo.png')) const contextMenu = Menu.buildFromTemplate([ { label: 'Active', type:'normal',role: 'front', click:try_click() }, { label: 'Prefe

当我们最小化应用程序时,如何使用托盘菜单调整窗口

const tray = new Tray(path.join(__dirname, '/assets/icons/commusoft-squarelogo.png'))
  const contextMenu = Menu.buildFromTemplate([
    { label: 'Active', type:'normal',role: 'front', click:try_click() },
    { label: 'Preferences', type: 'normal',click: try_click()},
    { label: 'Reload', type: 'normal', role: 'reload'},
    { label: 'Reload new', type: 'normal', role: 'reload'},
    { label: 'Quit', type: 'normal', role: 'quit' }
  ])
  tray.setToolTip('This is my application.')
  tray.setContextMenu(contextMenu)

提前感谢

现在终于找到答案了

const contextMenu = Menu.buildFromTemplate([
    { label: 'Active', type:'normal',role: 'front', click:function(){
                                                            win.show()
                                                      } 
    },
    { label: 'Preferences', type: 'normal',click: try_click()},
    { label: 'Reload', type: 'normal', role: 'reload'},
    { label: 'Reload new', type: 'normal', role: 'reload'},
    { label: 'Quit', type: 'normal', role: 'quit' }
  ])