mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2025-07-28 00:22:26 +02:00
This commit is contained in:
@@ -18,6 +18,7 @@ const settings = {
|
||||
port: "apiSettings.port",
|
||||
},
|
||||
mpris: "mpris",
|
||||
enableCustomHotkeys: "enableCustomHotkeys",
|
||||
trayIcon: "trayIcon",
|
||||
windowBounds: {
|
||||
root: "windowBounds",
|
||||
|
@@ -19,6 +19,7 @@ function refreshSettings() {
|
||||
menuBar.checked = store.get(settings.menuBar);
|
||||
trayIcon.checked = store.get(settings.trayIcon);
|
||||
mpris.checked = store.get(settings.mpris);
|
||||
enableCustomHotkeys.checked = store.get(settings.enableCustomHotkeys);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,6 +80,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
menuBar = get("menuBar");
|
||||
trayIcon = get("trayIcon");
|
||||
mpris = get("mprisCheckbox");
|
||||
enableCustomHotkeys = get("enableCustomHotkeys");
|
||||
|
||||
refreshSettings();
|
||||
|
||||
@@ -89,4 +91,5 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
addInputListener(menuBar, settings.menuBar);
|
||||
addInputListener(trayIcon, settings.trayIcon);
|
||||
addInputListener(mpris, settings.mpris);
|
||||
addInputListener(enableCustomHotkeys, settings.enableCustomHotkeys);
|
||||
});
|
||||
|
@@ -80,6 +80,16 @@
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</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>
|
||||
</section>
|
||||
<section id="api" class="tab-panel">
|
||||
|
@@ -29,7 +29,7 @@ const elements = {
|
||||
account: '*[data-test^="profile-image-button"]',
|
||||
settings: '*[data-test^="open-settings"]',
|
||||
media: '*[data-test="current-media-imagery"]',
|
||||
image: '*[class^="image--"]',
|
||||
image: "img",
|
||||
|
||||
/**
|
||||
* Get an element from the dom
|
||||
@@ -101,55 +101,38 @@ function playPause() {
|
||||
* https://defkey.com/tidal-desktop-shortcuts
|
||||
*/
|
||||
function addHotKeys() {
|
||||
hotkeys.add("Control+p", function () {
|
||||
elements.click("account").click("settings");
|
||||
});
|
||||
hotkeys.add("Control+l", function () {
|
||||
handleLogout();
|
||||
});
|
||||
if (store.get(settings.enableCustomHotkeys)) {
|
||||
hotkeys.add("Control+p", function () {
|
||||
elements.click("account").click("settings");
|
||||
});
|
||||
hotkeys.add("Control+l", function () {
|
||||
handleLogout();
|
||||
});
|
||||
|
||||
hotkeys.add("Control+h", function () {
|
||||
elements.click("home");
|
||||
});
|
||||
hotkeys.add("Control+h", function () {
|
||||
elements.click("home");
|
||||
});
|
||||
|
||||
hotkeys.add("backspace", function () {
|
||||
elements.click("back");
|
||||
});
|
||||
hotkeys.add("backspace", function () {
|
||||
elements.click("back");
|
||||
});
|
||||
|
||||
hotkeys.add("shift+backspace", function () {
|
||||
elements.click("forward");
|
||||
});
|
||||
hotkeys.add("shift+backspace", function () {
|
||||
elements.click("forward");
|
||||
});
|
||||
|
||||
hotkeys.add("control+f", function () {
|
||||
elements.focus("search");
|
||||
});
|
||||
hotkeys.add("control+u", function () {
|
||||
// reloading window without cache should show the update bar if applicable
|
||||
window.location.reload(true);
|
||||
});
|
||||
|
||||
hotkeys.add("control+u", function () {
|
||||
// reloading window without cache should show the update bar if applicable
|
||||
window.location.reload(true);
|
||||
});
|
||||
hotkeys.add("control+r", function () {
|
||||
elements.click("repeat");
|
||||
});
|
||||
}
|
||||
|
||||
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 () {
|
||||
elements.click("repeat");
|
||||
});
|
||||
|
||||
hotkeys.add("control+/", function () {
|
||||
// always add the hotkey for the settings window
|
||||
hotkeys.add("control+=", function () {
|
||||
ipcRenderer.send(globalEvents.showSettings);
|
||||
});
|
||||
}
|
||||
@@ -264,11 +247,13 @@ setInterval(function () {
|
||||
resolve();
|
||||
},
|
||||
() => {
|
||||
reject();
|
||||
// if the image can't be downloaded then continue without it
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
} else {
|
||||
reject();
|
||||
// if the image can't be found on the page continue without it
|
||||
resolve();
|
||||
}
|
||||
}).then(
|
||||
() => {
|
||||
|
@@ -16,6 +16,7 @@ const store = new Store({
|
||||
},
|
||||
trayIcon: true,
|
||||
mpris: false,
|
||||
enableCustomHotkeys: false,
|
||||
windowBounds: { width: 800, height: 600 },
|
||||
},
|
||||
});
|
||||
|
Reference in New Issue
Block a user