mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2024-11-22 21:42:46 +01:00
Merge pull request #448 from autumn-puffin/master
Add option to disable the discord rpc idle text
This commit is contained in:
commit
e2a84e119a
@ -30,6 +30,7 @@ export const settings = {
|
|||||||
buttonText: "discord.buttonText",
|
buttonText: "discord.buttonText",
|
||||||
includeTimestamps: "discord.includeTimestamps",
|
includeTimestamps: "discord.includeTimestamps",
|
||||||
showSong: "discord.showSong",
|
showSong: "discord.showSong",
|
||||||
|
showIdle: "discord.showIdle",
|
||||||
idleText: "discord.idleText",
|
idleText: "discord.idleText",
|
||||||
usingText: "discord.usingText",
|
usingText: "discord.usingText",
|
||||||
},
|
},
|
||||||
|
@ -58,6 +58,7 @@ let adBlock: HTMLInputElement,
|
|||||||
discord_include_timestamps: HTMLInputElement,
|
discord_include_timestamps: HTMLInputElement,
|
||||||
discord_button_text: HTMLInputElement,
|
discord_button_text: HTMLInputElement,
|
||||||
discord_show_song: HTMLInputElement,
|
discord_show_song: HTMLInputElement,
|
||||||
|
discord_show_idle: HTMLInputElement,
|
||||||
discord_idle_text: HTMLInputElement,
|
discord_idle_text: HTMLInputElement,
|
||||||
discord_using_text: HTMLInputElement;
|
discord_using_text: HTMLInputElement;
|
||||||
|
|
||||||
@ -151,6 +152,7 @@ function refreshSettings() {
|
|||||||
discord_include_timestamps.checked = settingsStore.get(settings.discord.includeTimestamps);
|
discord_include_timestamps.checked = settingsStore.get(settings.discord.includeTimestamps);
|
||||||
discord_button_text.value = settingsStore.get(settings.discord.buttonText);
|
discord_button_text.value = settingsStore.get(settings.discord.buttonText);
|
||||||
discord_show_song.checked = settingsStore.get(settings.discord.showSong);
|
discord_show_song.checked = settingsStore.get(settings.discord.showSong);
|
||||||
|
discord_show_idle.checked = settingsStore.get(settings.discord.showIdle);
|
||||||
discord_idle_text.value = settingsStore.get(settings.discord.idleText);
|
discord_idle_text.value = settingsStore.get(settings.discord.idleText);
|
||||||
discord_using_text.value = settingsStore.get(settings.discord.usingText);
|
discord_using_text.value = settingsStore.get(settings.discord.usingText);
|
||||||
|
|
||||||
@ -269,6 +271,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
listenbrainz_delay = get("listenbrainz_delay");
|
listenbrainz_delay = get("listenbrainz_delay");
|
||||||
discord_button_text = get("discord_button_text");
|
discord_button_text = get("discord_button_text");
|
||||||
discord_show_song = get("discord_show_song");
|
discord_show_song = get("discord_show_song");
|
||||||
|
discord_show_idle = get("discord_show_idle");
|
||||||
discord_using_text = get("discord_using_text");
|
discord_using_text = get("discord_using_text");
|
||||||
discord_idle_text = get("discord_idle_text");
|
discord_idle_text = get("discord_idle_text");
|
||||||
|
|
||||||
@ -312,6 +315,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
settings.discord.showSong,
|
settings.discord.showSong,
|
||||||
switchesWithSettings.discord_show_song
|
switchesWithSettings.discord_show_song
|
||||||
);
|
);
|
||||||
|
addInputListener(discord_show_idle, settings.discord.showIdle);
|
||||||
addInputListener(discord_idle_text, settings.discord.idleText);
|
addInputListener(discord_idle_text, settings.discord.idleText);
|
||||||
addInputListener(discord_using_text, settings.discord.usingText);
|
addInputListener(discord_using_text, settings.discord.usingText);
|
||||||
});
|
});
|
||||||
|
@ -227,6 +227,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="discord_options">
|
<div id="discord_options">
|
||||||
|
|
||||||
|
<div class="group__option" class="hidden">
|
||||||
|
<div class="group__description">
|
||||||
|
<h4>Show Idle Text</h4>
|
||||||
|
<p>Should the idle text be shown when idle?</p>
|
||||||
|
</div>
|
||||||
|
<label class="switch">
|
||||||
|
<input id="discord_show_idle" type="checkbox" />
|
||||||
|
<span class="switch__slider"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="group__option" class="hidden">
|
<div class="group__option" class="hidden">
|
||||||
<div class="group__description">
|
<div class="group__description">
|
||||||
<h4>Idle Text</h4>
|
<h4>Idle Text</h4>
|
||||||
|
@ -14,6 +14,10 @@ export let rpc: Client;
|
|||||||
|
|
||||||
const observer = () => {
|
const observer = () => {
|
||||||
if (rpc) {
|
if (rpc) {
|
||||||
|
const showIdle = settingsStore.get<string, boolean>(settings.discord.showIdle) ?? true;
|
||||||
|
if (mediaInfo.status === MediaStatus.paused && !showIdle) {
|
||||||
|
rpc.clearActivity();
|
||||||
|
} else
|
||||||
rpc.setActivity(getActivity());
|
rpc.setActivity(getActivity());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -95,6 +99,10 @@ export const initRPC = () => {
|
|||||||
rpc.login({ clientId }).then(
|
rpc.login({ clientId }).then(
|
||||||
() => {
|
() => {
|
||||||
rpc.on("ready", () => {
|
rpc.on("ready", () => {
|
||||||
|
const showIdle = settingsStore.get<string, boolean>(settings.discord.showIdle) ?? true;
|
||||||
|
if (mediaInfo.status === MediaStatus.paused && !showIdle) {
|
||||||
|
rpc.clearActivity();
|
||||||
|
} else
|
||||||
rpc.setActivity(getActivity());
|
rpc.setActivity(getActivity());
|
||||||
});
|
});
|
||||||
ipcMain.on(globalEvents.updateInfo, observer);
|
ipcMain.on(globalEvents.updateInfo, observer);
|
||||||
|
@ -43,6 +43,7 @@ export const settingsStore = new Store({
|
|||||||
enableDiscord: false,
|
enableDiscord: false,
|
||||||
discord: {
|
discord: {
|
||||||
showSong: true,
|
showSong: true,
|
||||||
|
showIdle: true,
|
||||||
idleText: "Browsing Tidal",
|
idleText: "Browsing Tidal",
|
||||||
usingText: "Playing media on TIDAL",
|
usingText: "Playing media on TIDAL",
|
||||||
includeTimestamps: true,
|
includeTimestamps: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user