From e2ea4d13c4429121ea8816e7b96a69c81bc8b728 Mon Sep 17 00:00:00 2001 From: Mastermindzh Date: Wed, 7 Oct 2020 20:10:31 +0200 Subject: [PATCH] added the option to disable the system tray icon and fixed the settings menu --- CHANGELOG.md | 10 ++++++++++ README.md | 7 ++++++- build/linux/arch/.SRCINFO | 4 ++-- build/linux/arch/PKGBUILD | 2 +- package.json | 2 +- src/constants/settings.js | 1 + src/main.js | 3 +-- src/pages/settings/preload.js | 9 ++++++--- src/pages/settings/settings.html | 23 ++++++++++++++++------- src/scripts/settings.js | 1 + src/scripts/tray.js | 9 ++++++--- 11 files changed, 51 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47cc429..648f1be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 1.2.0 + +- Added the ability to disable the tray icon + +## 1.1.1 + +Bugfixes: + +- Arch AUR install failed before, it is fixed now by using the included build scripts + ## 1.1.0 - updated to electron 8.0.0 diff --git a/README.md b/README.md index 4489da0..bed1915 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,12 @@ Whilst there are a handful of projects attempting to run Tidal on Electron they Sometimes it's just easier to start over, cover my own needs and then making it available to the public :) -## Special thanks to.. +## Special thanks to... - [Castlabs](https://castlabs.com/) For maintaining Electron with Widevine CDM installation, Verified Media Path (VMP), and persistent licenses (StorageID) + +## Buy me a coffee? Please don't + +Instead spend some money on a charity I care for: [kwf.nl](secure.kwf.nl/donation) +Inspired by [haydenjames' issue](https://github.com/Mastermindzh/tidal-hifi/issues/27#issuecomment-704198429) diff --git a/build/linux/arch/.SRCINFO b/build/linux/arch/.SRCINFO index b9fe2be..10c38ed 100644 --- a/build/linux/arch/.SRCINFO +++ b/build/linux/arch/.SRCINFO @@ -1,6 +1,6 @@ pkgbase = tidal-hifi-git pkgdesc = The web version of listen.tidal.com running in electron with hifi support thanks to widevine. - pkgver = 1.1.1 + pkgver = 1.2.0 pkgrel = 1 url = https://github.com/Mastermindzh/tidal-hifi arch = x86_64 @@ -11,7 +11,7 @@ pkgbase = tidal-hifi-git depends = nss depends = gtk3 provides = tidal-hifi - source = https://github.com/Mastermindzh/tidal-hifi/archive/1.1.1.zip + source = https://github.com/Mastermindzh/tidal-hifi/archive/1.2.0.zip source = tidal-hifi.desktop sha512sums = ed6127627400cc8d1a614f3084eaed0ee9109cc4be99ad8865a7cd68c45d9bbd7b20404c394930af005320da5cc2221a8818a7cb48d4cccc73991e88320408e5 sha512sums = 35f38ac308b871c1822d7f6f760f2fb54c3748cf769822cb0f0dfb90f0f5754ba9316da5e903a0d2e9839de3a43ec76f238f3f2e44021956fa1da19142081349 diff --git a/build/linux/arch/PKGBUILD b/build/linux/arch/PKGBUILD index 0eab65c..f46755c 100644 --- a/build/linux/arch/PKGBUILD +++ b/build/linux/arch/PKGBUILD @@ -2,7 +2,7 @@ _pkgname=tidal-hifi pkgname="$_pkgname-git" -pkgver=1.1.1 +pkgver=1.2.0 pkgrel=1 pkgdesc="The web version of listen.tidal.com running in electron with hifi support thanks to widevine." arch=("x86_64") diff --git a/package.json b/package.json index 7e9995c..b1cc373 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tidal-hifi", - "version": "1.1.1", + "version": "1.2.0", "description": "Tidal on Electron with widevine(hifi) support", "main": "src/main.js", "scripts": { diff --git a/src/constants/settings.js b/src/constants/settings.js index bdb7e21..9bb3291 100644 --- a/src/constants/settings.js +++ b/src/constants/settings.js @@ -18,6 +18,7 @@ const settings = { port: "apiSettings.port", }, mpris: "mpris", + trayIcon: "trayIcon", windowBounds: { root: "windowBounds", width: "windowBounds.width", diff --git a/src/main.js b/src/main.js index d818d28..686844c 100644 --- a/src/main.js +++ b/src/main.js @@ -83,8 +83,7 @@ app.on("ready", () => { addMenu(); createSettingsWindow(); addGlobalShortcuts(); - addTray({ icon }); - refreshTray(); + store.get(settings.trayIcon) && addTray({ icon }) && refreshTray(); store.get(settings.api) && expressModule.run(mainWindow); }); diff --git a/src/pages/settings/preload.js b/src/pages/settings/preload.js index c9dc5e5..2d0ee46 100644 --- a/src/pages/settings/preload.js +++ b/src/pages/settings/preload.js @@ -17,7 +17,8 @@ function refreshSettings() { api.checked = store.get(settings.api); port.value = store.get(settings.apiSettings.port); menuBar.checked = store.get(settings.menuBar); - mpris.checked = store.get(settings.mpris); + trayIcon.checked = store.get(settings.trayIcon); + // mpris.checked = store.get(settings.mpris); } /** @@ -76,7 +77,8 @@ window.addEventListener("DOMContentLoaded", () => { api = get("apiCheckbox"); port = get("port"); menuBar = get("menuBar"); - mpris = get("mprisCheckbox"); + trayIcon = get("trayIcon"); + // mpris = get("mprisCheckbox"); refreshSettings(); @@ -85,5 +87,6 @@ window.addEventListener("DOMContentLoaded", () => { addInputListener(api, settings.api); addInputListener(port, settings.apiSettings.port); addInputListener(menuBar, settings.menuBar); - addInputListener(mpris, settings.mpris); + addInputListener(trayIcon, settings.trayIcon); + // addInputListener(mpris, settings.mpris); }); diff --git a/src/pages/settings/settings.html b/src/pages/settings/settings.html index 8216b74..2e05352 100644 --- a/src/pages/settings/settings.html +++ b/src/pages/settings/settings.html @@ -68,15 +68,25 @@ +
+

System

+
+

Tray icon

+

+ Show Tidal-hifi's tray icon
+

+ +
+

Api

Tidal-hifi has a web api built in to allow users to get current song information. You can optionally enable playback control as well. -
-
- * api changes require a restart to update

@@ -104,15 +114,12 @@
-

integrations

Tidal-hifi is extensible trough the use of integrations. You can enable or disable integrations here -
- * not all integrations require restarting but some do, your best bet is to restart :)

-
@@ -138,6 +144,9 @@
+ + Some settings require a restart of Tidal-hifi. To do so click the button below: + diff --git a/src/scripts/settings.js b/src/scripts/settings.js index f6bc7a2..56c3ef4 100644 --- a/src/scripts/settings.js +++ b/src/scripts/settings.js @@ -14,6 +14,7 @@ const store = new Store({ apiSettings: { port: 47836, }, + trayIcon: true, mpris: false, windowBounds: { width: 800, height: 600 }, }, diff --git a/src/scripts/tray.js b/src/scripts/tray.js index ad9fdee..88b7344 100644 --- a/src/scripts/tray.js +++ b/src/scripts/tray.js @@ -3,12 +3,15 @@ const { getMenu } = require("./menu"); const trayModule = {}; let tray; -trayModule.addTray = function(options = { icon: "" }) { +trayModule.addTray = function (options = { icon: "" }) { tray = new Tray(options.icon); }; -trayModule.refreshTray = function() { - tray.on("click", function(e) { +trayModule.refreshTray = function () { + if (!tray) { + trayModule.addTray(); + } + tray.on("click", function (e) { // do nothing on click });