2019-11-03 20:22:59 +01:00
|
|
|
const { Tray } = require("electron");
|
|
|
|
const { getMenu } = require("./menu");
|
2019-10-30 21:43:52 +01:00
|
|
|
const trayModule = {};
|
|
|
|
let tray;
|
|
|
|
|
2020-10-07 20:10:31 +02:00
|
|
|
trayModule.addTray = function (options = { icon: "" }) {
|
2019-10-30 21:43:52 +01:00
|
|
|
tray = new Tray(options.icon);
|
|
|
|
};
|
|
|
|
|
2020-10-07 20:10:31 +02:00
|
|
|
trayModule.refreshTray = function () {
|
|
|
|
if (!tray) {
|
|
|
|
trayModule.addTray();
|
|
|
|
}
|
|
|
|
tray.on("click", function (e) {
|
2019-11-03 20:22:59 +01:00
|
|
|
// do nothing on click
|
|
|
|
});
|
|
|
|
|
|
|
|
tray.setToolTip("Tidal-hifi");
|
|
|
|
tray.setContextMenu(getMenu());
|
2019-10-30 21:43:52 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = trayModule;
|