2022-08-07 16:05:48 +02:00
|
|
|
const { Tray } = require("electron");
|
|
|
|
const { getMenu } = require("./menu");
|
2019-10-30 21:43:52 +01:00
|
|
|
const trayModule = {};
|
|
|
|
let tray;
|
|
|
|
|
2022-08-07 16:05:48 +02:00
|
|
|
trayModule.addTray = function (mainWindow, options = { icon: "" }) {
|
2019-10-30 21:43:52 +01:00
|
|
|
tray = new Tray(options.icon);
|
2022-08-07 16:05:48 +02:00
|
|
|
tray.setIgnoreDoubleClickEvents(true);
|
|
|
|
tray.setToolTip("Tidal-hifi");
|
|
|
|
|
|
|
|
const menu = getMenu(mainWindow);
|
|
|
|
|
|
|
|
tray.setContextMenu(menu);
|
2019-10-30 21:43:52 +01:00
|
|
|
};
|
|
|
|
|
2021-06-17 20:37:14 +02:00
|
|
|
trayModule.refreshTray = function (mainWindow) {
|
2020-10-07 20:10:31 +02:00
|
|
|
if (!tray) {
|
2022-08-07 16:05:48 +02:00
|
|
|
trayModule.addTray(mainWindow);
|
2021-06-17 20:37:14 +02:00
|
|
|
}
|
2019-10-30 21:43:52 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = trayModule;
|