Changes some hotkeys around and fixed some bugs with the hotkeys. Fixes #34 and #35

This commit is contained in:
Rick van Lieshout 2021-01-10 13:52:22 +01:00
parent 87a4ff3fc5
commit fb9082e995
11 changed files with 64 additions and 53 deletions

View File

@ -4,6 +4,17 @@ 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/), 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## 2.0.0
### Breaking changes
- Changed settings hotkey from "ctrl+/" to "ctrl+=" to avoid a conflict with the default Tidal hotkeys
## Other changes
- Added a setting to disable custom hotkeys
- Fixed the bug that backwards would register 3 times. (Twice due to a duplicate block of code + once from the default tidal hotkey)
## 1.3.0 ## 1.3.0
-- re-enabled mpris-service wit the electron downloader fixes -- re-enabled mpris-service wit the electron downloader fixes

View File

@ -66,9 +66,9 @@ To install and work with the code on this project follow these steps:
- HiFi playback - HiFi playback
- Notifications - Notifications
- Shortcuts ([source](https://defkey.com/tidal-desktop-shortcuts)) - Custom hotkeys ([source](https://defkey.com/tidal-desktop-shortcuts))
- API for status and playback - API for status and playback
- [Settings feature](./docs/settings.png) to disable certain functionality. (`ctrl+/`) - [Settings feature](./docs/settings.png) to disable certain functionality. (`ctrl+=`)
## Integrations ## Integrations

View File

@ -1,6 +1,6 @@
pkgbase = tidal-hifi-git pkgbase = tidal-hifi-git
pkgdesc = The web version of listen.tidal.com running in electron with hifi support thanks to widevine. pkgdesc = The web version of listen.tidal.com running in electron with hifi support thanks to widevine.
pkgver = 1.2.0 pkgver = 2.0.0
pkgrel = 1 pkgrel = 1
url = https://github.com/Mastermindzh/tidal-hifi url = https://github.com/Mastermindzh/tidal-hifi
arch = x86_64 arch = x86_64
@ -11,7 +11,7 @@ pkgbase = tidal-hifi-git
depends = nss depends = nss
depends = gtk3 depends = gtk3
provides = tidal-hifi provides = tidal-hifi
source = https://github.com/Mastermindzh/tidal-hifi/archive/1.2.0.zip source = https://github.com/Mastermindzh/tidal-hifi/archive/2.0.0.zip
source = tidal-hifi.desktop source = tidal-hifi.desktop
sha512sums = e1c0e47257cebe6b2609131964f0971c3eb70fc28c86f3d7177cb3cea09a3311236f4147bafa91347210fe2c96e6bd9d2e4ac7ca5b105e0c899657645705913d sha512sums = e1c0e47257cebe6b2609131964f0971c3eb70fc28c86f3d7177cb3cea09a3311236f4147bafa91347210fe2c96e6bd9d2e4ac7ca5b105e0c899657645705913d
sha512sums = 35f38ac308b871c1822d7f6f760f2fb54c3748cf769822cb0f0dfb90f0f5754ba9316da5e903a0d2e9839de3a43ec76f238f3f2e44021956fa1da19142081349 sha512sums = 35f38ac308b871c1822d7f6f760f2fb54c3748cf769822cb0f0dfb90f0f5754ba9316da5e903a0d2e9839de3a43ec76f238f3f2e44021956fa1da19142081349

View File

@ -2,7 +2,7 @@
_pkgname=tidal-hifi _pkgname=tidal-hifi
pkgname="$_pkgname-git" pkgname="$_pkgname-git"
pkgver=1.2.0 pkgver=2.0.0
pkgrel=1 pkgrel=1
pkgdesc="The web version of listen.tidal.com running in electron with hifi support thanks to widevine." pkgdesc="The web version of listen.tidal.com running in electron with hifi support thanks to widevine."
arch=("x86_64") arch=("x86_64")

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "tidal-hifi", "name": "tidal-hifi",
"version": "1.3.0", "version": "2.0.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "tidal-hifi", "name": "tidal-hifi",
"version": "1.3.0", "version": "2.0.0",
"description": "Tidal on Electron with widevine(hifi) support", "description": "Tidal on Electron with widevine(hifi) support",
"main": "src/main.js", "main": "src/main.js",
"scripts": { "scripts": {

View File

@ -18,6 +18,7 @@ const settings = {
port: "apiSettings.port", port: "apiSettings.port",
}, },
mpris: "mpris", mpris: "mpris",
enableCustomHotkeys: "enableCustomHotkeys",
trayIcon: "trayIcon", trayIcon: "trayIcon",
windowBounds: { windowBounds: {
root: "windowBounds", root: "windowBounds",

View File

@ -19,6 +19,7 @@ function refreshSettings() {
menuBar.checked = store.get(settings.menuBar); menuBar.checked = store.get(settings.menuBar);
trayIcon.checked = store.get(settings.trayIcon); trayIcon.checked = store.get(settings.trayIcon);
mpris.checked = store.get(settings.mpris); mpris.checked = store.get(settings.mpris);
enableCustomHotkeys.checked = store.get(settings.enableCustomHotkeys);
} }
/** /**
@ -79,6 +80,7 @@ window.addEventListener("DOMContentLoaded", () => {
menuBar = get("menuBar"); menuBar = get("menuBar");
trayIcon = get("trayIcon"); trayIcon = get("trayIcon");
mpris = get("mprisCheckbox"); mpris = get("mprisCheckbox");
enableCustomHotkeys = get("enableCustomHotkeys");
refreshSettings(); refreshSettings();
@ -89,4 +91,5 @@ window.addEventListener("DOMContentLoaded", () => {
addInputListener(menuBar, settings.menuBar); addInputListener(menuBar, settings.menuBar);
addInputListener(trayIcon, settings.trayIcon); addInputListener(trayIcon, settings.trayIcon);
addInputListener(mpris, settings.mpris); addInputListener(mpris, settings.mpris);
addInputListener(enableCustomHotkeys, settings.enableCustomHotkeys);
}); });

View File

@ -80,6 +80,16 @@
<span class="slider round"></span> <span class="slider round"></span>
</label> </label>
</div> </div>
<div class="option">
<h4>Hotkeys</h4>
<p>
Enables extra hotkeys to achieve feature parity with the <a href = "javascript:openExternal('https://defkey.com/tidal-desktop-shortcuts')">desktop apps</a><br />
</p>
<label class="switch">
<input id="enableCustomHotkeys" type="checkbox">
<span class="slider round"></span>
</label>
</div>
</div> </div>
</section> </section>
<section id="api" class="tab-panel"> <section id="api" class="tab-panel">

View File

@ -29,7 +29,7 @@ const elements = {
account: '*[data-test^="profile-image-button"]', account: '*[data-test^="profile-image-button"]',
settings: '*[data-test^="open-settings"]', settings: '*[data-test^="open-settings"]',
media: '*[data-test="current-media-imagery"]', media: '*[data-test="current-media-imagery"]',
image: '*[class^="image--"]', image: "img",
/** /**
* Get an element from the dom * Get an element from the dom
@ -101,6 +101,7 @@ function playPause() {
* https://defkey.com/tidal-desktop-shortcuts * https://defkey.com/tidal-desktop-shortcuts
*/ */
function addHotKeys() { function addHotKeys() {
if (store.get(settings.enableCustomHotkeys)) {
hotkeys.add("Control+p", function () { hotkeys.add("Control+p", function () {
elements.click("account").click("settings"); elements.click("account").click("settings");
}); });
@ -120,36 +121,18 @@ function addHotKeys() {
elements.click("forward"); elements.click("forward");
}); });
hotkeys.add("control+f", function () {
elements.focus("search");
});
hotkeys.add("control+u", function () { hotkeys.add("control+u", function () {
// reloading window without cache should show the update bar if applicable // reloading window without cache should show the update bar if applicable
window.location.reload(true); window.location.reload(true);
}); });
hotkeys.add("control+left", function () {
elements.click("previous");
});
hotkeys.add("control+right", function () {
elements.click("next");
});
hotkeys.add("control+right", function () {
elements.click("next");
});
hotkeys.add("control+s", function () {
elements.click("shuffle");
});
hotkeys.add("control+r", function () { hotkeys.add("control+r", function () {
elements.click("repeat"); elements.click("repeat");
}); });
}
hotkeys.add("control+/", function () { // always add the hotkey for the settings window
hotkeys.add("control+=", function () {
ipcRenderer.send(globalEvents.showSettings); ipcRenderer.send(globalEvents.showSettings);
}); });
} }
@ -264,11 +247,13 @@ setInterval(function () {
resolve(); resolve();
}, },
() => { () => {
reject(); // if the image can't be downloaded then continue without it
resolve();
} }
); );
} else { } else {
reject(); // if the image can't be found on the page continue without it
resolve();
} }
}).then( }).then(
() => { () => {

View File

@ -16,6 +16,7 @@ const store = new Store({
}, },
trayIcon: true, trayIcon: true,
mpris: false, mpris: false,
enableCustomHotkeys: false,
windowBounds: { width: 800, height: 600 }, windowBounds: { width: 800, height: 600 },
}, },
}); });