Skip to content

Commit

Permalink
staticWindowTitle(fix): Order alphabetically on all appearances, chan…
Browse files Browse the repository at this point in the history
…ge if to a ternary
  • Loading branch information
darkiox committed Oct 23, 2024
1 parent cb8667b commit 974877e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/constants/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ export const settings = {
singleInstance: "singleInstance",
skipArtists: "skipArtists",
skippedArtists: "skippedArtists",
staticWindowTitle: "staticWindowTitle",
theme: "theme",
trayIcon: "trayIcon",
staticWindowTitle: "staticWindowTitle",
updateFrequency: "updateFrequency",
windowBounds: {
root: "windowBounds",
Expand Down
10 changes: 5 additions & 5 deletions src/pages/settings/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ let adBlock: HTMLInputElement,
singleInstance: HTMLInputElement,
skipArtists: HTMLInputElement,
skippedArtists: HTMLInputElement,
staticWindowTitle: HTMLInputElement,
theme: HTMLSelectElement,
trayIcon: HTMLInputElement,
staticWindowTitle: HTMLInputElement,
updateFrequency: HTMLInputElement,
enableListenBrainz: HTMLInputElement,
ListenBrainzAPI: HTMLInputElement,
Expand Down Expand Up @@ -141,10 +141,10 @@ function refreshSettings() {
port.value = settingsStore.get(settings.apiSettings.port);
singleInstance.checked = settingsStore.get(settings.singleInstance);
skipArtists.checked = settingsStore.get(settings.skipArtists);
theme.value = settingsStore.get(settings.theme);
skippedArtists.value = settingsStore.get<string, string[]>(settings.skippedArtists).join("\n");
trayIcon.checked = settingsStore.get(settings.trayIcon);
staticWindowTitle.checked = settingsStore.get(settings.staticWindowTitle);
theme.value = settingsStore.get(settings.theme);
trayIcon.checked = settingsStore.get(settings.trayIcon);
updateFrequency.value = settingsStore.get(settings.updateFrequency);
enableListenBrainz.checked = settingsStore.get(settings.ListenBrainz.enabled);
ListenBrainzAPI.value = settingsStore.get(settings.ListenBrainz.api);
Expand Down Expand Up @@ -261,9 +261,9 @@ window.addEventListener("DOMContentLoaded", () => {
port = get("port");
theme = get<HTMLSelectElement>("themesList");
trayIcon = get("trayIcon");
staticWindowTitle = get("staticWindowTitle");
skipArtists = get("skipArtists");
skippedArtists = get("skippedArtists");
staticWindowTitle = get("staticWindowTitle");
singleInstance = get("singleInstance");
updateFrequency = get("updateFrequency");
enableListenBrainz = get("enableListenBrainz");
Expand Down Expand Up @@ -298,10 +298,10 @@ window.addEventListener("DOMContentLoaded", () => {
addInputListener(port, settings.apiSettings.port);
addInputListener(skipArtists, settings.skipArtists);
addTextAreaListener(skippedArtists, settings.skippedArtists);
addInputListener(staticWindowTitle, settings.staticWindowTitle);
addInputListener(singleInstance, settings.singleInstance);
addSelectListener(theme, settings.theme);
addInputListener(trayIcon, settings.trayIcon);
addInputListener(staticWindowTitle, settings.staticWindowTitle);
addInputListener(updateFrequency, settings.updateFrequency);
addInputListener(
enableListenBrainz,
Expand Down
3 changes: 1 addition & 2 deletions src/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,7 @@ setInterval(function () {
};

// update title, url and play info with new info
if(settingsStore.get(settings.staticWindowTitle)) setTitle(staticTitle)
else setTitle(songDashArtistTitle);
settingsStore.get(settings.staticWindowTitle) ? setTitle(staticTitle) : setTitle(songDashArtistTitle);
getTrackURL();
currentSong = songDashArtistTitle;
currentPlayStatus = currentStatus;
Expand Down
10 changes: 5 additions & 5 deletions src/scripts/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ export const settingsStore = new Store({
singleInstance: true,
skipArtists: false,
skippedArtists: [""],
staticWindowTitle: false,
theme: "none",
trayIcon: true,
staticWindowTitle: false,
updateFrequency: 500,
windowBounds: { width: 800, height: 600 },
},
Expand Down Expand Up @@ -128,7 +128,7 @@ const settingsModule = {
settingsWindow,
};

export const createSettingsWindow = function() {
export const createSettingsWindow = function () {
settingsWindow = new BrowserWindow({
width: 650,
height: 700,
Expand Down Expand Up @@ -160,7 +160,7 @@ export const createSettingsWindow = function() {
settingsModule.settingsWindow = settingsWindow;
};

export const showSettingsWindow = function(tab = "general") {
export const showSettingsWindow = function (tab = "general") {
if (!settingsWindow) {
console.log("Settings window is not initialized. Attempting to create it.");
createSettingsWindow();
Expand All @@ -171,11 +171,11 @@ export const showSettingsWindow = function(tab = "general") {
settingsWindow.webContents.send("refreshData");
settingsWindow.show();
};
export const hideSettingsWindow = function() {
export const hideSettingsWindow = function () {
settingsWindow.hide();
};

export const closeSettingsWindow = function() {
export const closeSettingsWindow = function () {
settingsWindow = null;
};

Expand Down

0 comments on commit 974877e

Please sign in to comment.