added a custom menu and enabled the menu by default

This commit is contained in:
2019-11-03 20:22:59 +01:00
parent f8aa97c15e
commit 94ed652619
8 changed files with 149 additions and 14 deletions

View File

@@ -1,4 +1,5 @@
const { Tray, Menu } = require("electron");
const { Tray } = require("electron");
const { getMenu } = require("./menu");
const trayModule = {};
let tray;
@@ -7,14 +8,12 @@ trayModule.addTray = function(options = { icon: "" }) {
};
trayModule.refreshTray = function() {
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);
tray.on("click", function(e) {
// do nothing on click
});
tray.setToolTip("Tidal-hifi");
tray.setContextMenu(getMenu());
};
module.exports = trayModule;