4

I'm building an electron app and I realized that the tray icon on Windows does now appear on the main taskbar, but in the area that pops out when you click the upward arrow.

enter image description here

I see that Dropbox has theirs on the main taskbar and I know I can move mine on the main taskbar, but I would love to have it there by default.

Thank you in advance!

1 Answers1

0

I was looking for the same things, this is what worked for me:

const { Menu, Tray } = require('electron')

let tray = null
app.whenReady().then(() => {
  //add your path
  tray = new Tray(path.join(app.getAppPath(), 'src', 'assets', 'company.jpg'))
  const contextMenu = Menu.buildFromTemplate([
    { label: 'Item1', type: 'radio' },
    { label: 'Item2', type: 'radio' },
    { label: 'Item3', type: 'radio', checked: true },
    { label: 'Item4', type: 'radio' }
  ])
  tray.setToolTip('This is my application.')
  tray.setContextMenu(contextMenu)
})

hope It helps, and make sure you use the app.getAppPath() otherwise it will run on your electron build but won't work on win. package

Ishan Shah
  • 383
  • 2
  • 8