fix: fixed tray click bug. fixes #196

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

View File

@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Replaced "muting artists" with a full implementation of an Adblock mechanism
> Disabled audio & visual ads, unlocked lyrics, suggested track, track info, unlimited skips thanks to uBlockOrigin custom filters ([source](https://github.com/uBlockOrigin/uAssets/issues/17495))
- @thanasistrisp updated Electron to 24.1.2 and fixed the tray bug :)
## 4.4.0
- Updated shortcut hint on the menubar to reflect the new `ctrl+=` shortcut.

View File

@ -1,8 +1,7 @@
appId: com.rickvanlieshout.tidal-hifi
electronVersion: 19.0.5
electronVersion: 24.1.2
electronDownload:
version: 19.0.5+wvcus
mirror: https://github.com/castlabs/electron-releases/releases/download/v
version: 24.1.2+wvcus
snap:
plugs:
- default

4
package-lock.json generated
View File

@ -20,7 +20,7 @@
},
"devDependencies": {
"@mastermindzh/prettier-config": "^1.0.0",
"electron": "git+https://github.com/castlabs/electron-releases.git#v19.0.5+wvcus",
"electron": "git+https://github.com/castlabs/electron-releases.git#v24.1.2+wvcus",
"electron-builder": "^24.2.1",
"js-yaml": "^3.14.1",
"markdown-toc": "^1.2.0",
@ -10197,7 +10197,7 @@
},
"electron": {
"version": "git+ssh://git@github.com/castlabs/electron-releases.git#b7e63c1416bbebfb25a5eddebd2049d65996ff26",
"from": "electron@git+https://github.com/castlabs/electron-releases.git#v19.0.5+wvcus",
"from": "electron@git+https://github.com/castlabs/electron-releases.git#v24.1.2+wvcus",
"requires": {
"@electron/get": "^1.14.1",
"@types/node": "^16.11.26",

View File

@ -42,7 +42,7 @@
},
"devDependencies": {
"@mastermindzh/prettier-config": "^1.0.0",
"electron": "git+https://github.com/castlabs/electron-releases.git#v19.0.5+wvcus",
"electron": "git+https://github.com/castlabs/electron-releases.git#v24.1.2+wvcus",
"electron-builder": "^24.2.1",
"js-yaml": "^3.14.1",
"markdown-toc": "^1.2.0",

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();
}
});
};