Reputation: 1245
I have just developed an electron app and a use suggested adding an icon to the bottom right of the task bar to easily open it and access it. I would like to add an icon to the area in the picture below:
I had a look in the electron docs but could not find anything.
Is this possible and if so how?
Upvotes: 1
Views: 3729
Reputation: 31
// Electron taskbar
const {app, Tray, Menu} = require('electron')
app.on('ready', () => {
tray = new Tray(path.join(__dirname, 'icon/favicon.ico'))
if (process.platform === 'win32' ) {
tray.on('click', tray.popUpContextMenu)
}
const menu = Menu.buildFromTemplate ([
{
label: 'Exit',
click() { app.quit()}
},
{ label: 'Help',
click() { null; }}
])
tray.setToolTip('AppName')
tray.setContextMenu(menu)
})
Upvotes: 1
Reputation: 5333
That area is called the "system tray" and you can add a system tray icon for your electron app using Electron's Tray API. You can find the documentation for the Tray
class here and may also take a look at this tutorial.
Upvotes: 3