fix: fixed tray click bug. fixes #196

This commit is contained in:
2023-04-22 20:51:20 +02:00
parent 166ca353cf
commit af20092053
6 changed files with 18 additions and 8 deletions

View File

@@ -91,6 +91,7 @@ function createWindow(options = {}) {
backgroundColor: options.backgroundColor,
autoHideMenuBar: true,
webPreferences: {
sandbox: false,
preload: path.join(__dirname, "preload.js"),
plugins: true,
devTools: true, // I like tinkering, others might too
@@ -159,7 +160,7 @@ app.on("ready", async () => {
if (store.get(settings.adBlock)) {
const filter = { urls: ["https://listen.tidal.com/*"] };
session.defaultSession.webRequest.onBeforeRequest(filter, (details, callback) => {
if (details.url.match(/\d\?country/)) callback({ cancel: true });
if (details.url.match(/\/users\/.*\d\?country/)) callback({ cancel: true });
else callback({ cancel: false });
});
}

View File

@@ -13,7 +13,15 @@ trayModule.addTray = function (mainWindow, options = { icon: "" }) {
tray.setContextMenu(menu);
tray.on("click", function () {
mainWindow.isVisible() ? mainWindow.focus() : mainWindow.show();
if (mainWindow.isVisible()) {
if (!mainWindow.isFocused()) {
mainWindow.focus();
} else {
mainWindow.hide();
}
} else {
mainWindow.show();
}
});
};