tidal-hifi/src/scripts/tray.js

23 lines
457 B
JavaScript
Raw Normal View History

const { Tray } = require("electron");
const { getMenu } = require("./menu");
const trayModule = {};
let tray;
trayModule.addTray = function (options = { icon: "" }) {
tray = new Tray(options.icon);
};
trayModule.refreshTray = function () {
if (!tray) {
trayModule.addTray();
}
tray.on("click", function (e) {
// do nothing on click
});
tray.setToolTip("Tidal-hifi");
tray.setContextMenu(getMenu());
};
module.exports = trayModule;