I'm currently searching for a way to display number values in the macOS menubar. Tools like iStat Menus 6 show that it's possible to display advanced widgets in the macOS menubar like number values and charts, see here.
I would like to create a number widget in my electron application. However, I cannot find a way to get started. What I have found is the Tray class from the electron package. It allows to create a tray icon using an image like a png:
const path = require('path');
const {
app,
Menu,
Tray,
} = require('electron');
let tray = null;
app.on('ready', () => {
tray = new Tray(path.join(__dirname, '/Icon.png'));
if (process.platform === 'win32') {
tray.on('click', tray.popUpContextMenu);
}
const menu = Menu.buildFromTemplate([
{
label: 'Quit',
click() { app.quit(); }
}
]);
tray.setToolTip('Clipmaster');
tray.setContextMenu(menu);
});
How do applications like iStat create such powerful widgets? It does not look like iStat is rendering their widgets to images.