Robert
Robert

Reputation: 3483

Electron app reactivate window using Tray Icon

when we Minimize the application, how reactive the window by using Tray menu

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)

Thanks in advance!!!

Upvotes: 0

Views: 483

Answers (1)

Robert
Robert

Reputation: 3483

now finally figure out the answer

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' }
  ])

Upvotes: 1

Related Questions