mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2024-11-22 21:42:46 +01:00
feat: Added ability to keep a static window title.
This commit is contained in:
parent
91156e5936
commit
cb8667bd41
@ -57,6 +57,7 @@ export const settings = {
|
|||||||
skippedArtists: "skippedArtists",
|
skippedArtists: "skippedArtists",
|
||||||
theme: "theme",
|
theme: "theme",
|
||||||
trayIcon: "trayIcon",
|
trayIcon: "trayIcon",
|
||||||
|
staticWindowTitle: "staticWindowTitle",
|
||||||
updateFrequency: "updateFrequency",
|
updateFrequency: "updateFrequency",
|
||||||
windowBounds: {
|
windowBounds: {
|
||||||
root: "windowBounds",
|
root: "windowBounds",
|
||||||
|
@ -48,6 +48,7 @@ let adBlock: HTMLInputElement,
|
|||||||
skippedArtists: HTMLInputElement,
|
skippedArtists: HTMLInputElement,
|
||||||
theme: HTMLSelectElement,
|
theme: HTMLSelectElement,
|
||||||
trayIcon: HTMLInputElement,
|
trayIcon: HTMLInputElement,
|
||||||
|
staticWindowTitle: HTMLInputElement,
|
||||||
updateFrequency: HTMLInputElement,
|
updateFrequency: HTMLInputElement,
|
||||||
enableListenBrainz: HTMLInputElement,
|
enableListenBrainz: HTMLInputElement,
|
||||||
ListenBrainzAPI: HTMLInputElement,
|
ListenBrainzAPI: HTMLInputElement,
|
||||||
@ -143,6 +144,7 @@ function refreshSettings() {
|
|||||||
theme.value = settingsStore.get(settings.theme);
|
theme.value = settingsStore.get(settings.theme);
|
||||||
skippedArtists.value = settingsStore.get<string, string[]>(settings.skippedArtists).join("\n");
|
skippedArtists.value = settingsStore.get<string, string[]>(settings.skippedArtists).join("\n");
|
||||||
trayIcon.checked = settingsStore.get(settings.trayIcon);
|
trayIcon.checked = settingsStore.get(settings.trayIcon);
|
||||||
|
staticWindowTitle.checked = settingsStore.get(settings.staticWindowTitle);
|
||||||
updateFrequency.value = settingsStore.get(settings.updateFrequency);
|
updateFrequency.value = settingsStore.get(settings.updateFrequency);
|
||||||
enableListenBrainz.checked = settingsStore.get(settings.ListenBrainz.enabled);
|
enableListenBrainz.checked = settingsStore.get(settings.ListenBrainz.enabled);
|
||||||
ListenBrainzAPI.value = settingsStore.get(settings.ListenBrainz.api);
|
ListenBrainzAPI.value = settingsStore.get(settings.ListenBrainz.api);
|
||||||
@ -259,6 +261,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
port = get("port");
|
port = get("port");
|
||||||
theme = get<HTMLSelectElement>("themesList");
|
theme = get<HTMLSelectElement>("themesList");
|
||||||
trayIcon = get("trayIcon");
|
trayIcon = get("trayIcon");
|
||||||
|
staticWindowTitle = get("staticWindowTitle");
|
||||||
skipArtists = get("skipArtists");
|
skipArtists = get("skipArtists");
|
||||||
skippedArtists = get("skippedArtists");
|
skippedArtists = get("skippedArtists");
|
||||||
singleInstance = get("singleInstance");
|
singleInstance = get("singleInstance");
|
||||||
@ -298,6 +301,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
addInputListener(singleInstance, settings.singleInstance);
|
addInputListener(singleInstance, settings.singleInstance);
|
||||||
addSelectListener(theme, settings.theme);
|
addSelectListener(theme, settings.theme);
|
||||||
addInputListener(trayIcon, settings.trayIcon);
|
addInputListener(trayIcon, settings.trayIcon);
|
||||||
|
addInputListener(staticWindowTitle, settings.staticWindowTitle);
|
||||||
addInputListener(updateFrequency, settings.updateFrequency);
|
addInputListener(updateFrequency, settings.updateFrequency);
|
||||||
addInputListener(
|
addInputListener(
|
||||||
enableListenBrainz,
|
enableListenBrainz,
|
||||||
|
@ -106,6 +106,16 @@
|
|||||||
<span class="switch__slider"></span>
|
<span class="switch__slider"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="group__option">
|
||||||
|
<div class="group__description">
|
||||||
|
<h4>Static Window Title</h4>
|
||||||
|
<p>Makes the window title "TIDAL Hi-Fi" instead of changing to the currently playing song.</p>
|
||||||
|
</div>
|
||||||
|
<label class="switch">
|
||||||
|
<input id="staticWindowTitle" type="checkbox" />
|
||||||
|
<span class="switch__slider"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="group__option">
|
<div class="group__option">
|
||||||
<div class="group__description">
|
<div class="group__description">
|
||||||
<h4>Minimize on Close</h4>
|
<h4>Minimize on Close</h4>
|
||||||
|
@ -550,6 +550,7 @@ setInterval(function () {
|
|||||||
const artistsArray = elements.getArtistsArray();
|
const artistsArray = elements.getArtistsArray();
|
||||||
const artistsString = elements.getArtistsString(artistsArray);
|
const artistsString = elements.getArtistsString(artistsArray);
|
||||||
const songDashArtistTitle = `${title} - ${artistsString}`;
|
const songDashArtistTitle = `${title} - ${artistsString}`;
|
||||||
|
const staticTitle = "TIDAL Hi-Fi"
|
||||||
const titleOrArtistsChanged = currentSong !== songDashArtistTitle;
|
const titleOrArtistsChanged = currentSong !== songDashArtistTitle;
|
||||||
const current = elements.getText("current");
|
const current = elements.getText("current");
|
||||||
const currentStatus = getCurrentlyPlayingStatus();
|
const currentStatus = getCurrentlyPlayingStatus();
|
||||||
@ -594,7 +595,8 @@ setInterval(function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// update title, url and play info with new info
|
// update title, url and play info with new info
|
||||||
setTitle(songDashArtistTitle);
|
if(settingsStore.get(settings.staticWindowTitle)) setTitle(staticTitle)
|
||||||
|
else setTitle(songDashArtistTitle);
|
||||||
getTrackURL();
|
getTrackURL();
|
||||||
currentSong = songDashArtistTitle;
|
currentSong = songDashArtistTitle;
|
||||||
currentPlayStatus = currentStatus;
|
currentPlayStatus = currentStatus;
|
||||||
|
@ -71,6 +71,7 @@ export const settingsStore = new Store({
|
|||||||
skippedArtists: [""],
|
skippedArtists: [""],
|
||||||
theme: "none",
|
theme: "none",
|
||||||
trayIcon: true,
|
trayIcon: true,
|
||||||
|
staticWindowTitle: false,
|
||||||
updateFrequency: 500,
|
updateFrequency: 500,
|
||||||
windowBounds: { width: 800, height: 600 },
|
windowBounds: { width: 800, height: 600 },
|
||||||
},
|
},
|
||||||
@ -127,7 +128,7 @@ const settingsModule = {
|
|||||||
settingsWindow,
|
settingsWindow,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createSettingsWindow = function () {
|
export const createSettingsWindow = function() {
|
||||||
settingsWindow = new BrowserWindow({
|
settingsWindow = new BrowserWindow({
|
||||||
width: 650,
|
width: 650,
|
||||||
height: 700,
|
height: 700,
|
||||||
@ -159,7 +160,7 @@ export const createSettingsWindow = function () {
|
|||||||
settingsModule.settingsWindow = settingsWindow;
|
settingsModule.settingsWindow = settingsWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const showSettingsWindow = function (tab = "general") {
|
export const showSettingsWindow = function(tab = "general") {
|
||||||
if (!settingsWindow) {
|
if (!settingsWindow) {
|
||||||
console.log("Settings window is not initialized. Attempting to create it.");
|
console.log("Settings window is not initialized. Attempting to create it.");
|
||||||
createSettingsWindow();
|
createSettingsWindow();
|
||||||
@ -170,11 +171,11 @@ export const showSettingsWindow = function (tab = "general") {
|
|||||||
settingsWindow.webContents.send("refreshData");
|
settingsWindow.webContents.send("refreshData");
|
||||||
settingsWindow.show();
|
settingsWindow.show();
|
||||||
};
|
};
|
||||||
export const hideSettingsWindow = function () {
|
export const hideSettingsWindow = function() {
|
||||||
settingsWindow.hide();
|
settingsWindow.hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
export const closeSettingsWindow = function () {
|
export const closeSettingsWindow = function() {
|
||||||
settingsWindow = null;
|
settingsWindow = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user