thanks discord [support changing listen type]

This commit is contained in:
Kendall Garner 2024-08-23 10:34:18 -07:00
parent 284db988c9
commit 906ffee8bc
No known key found for this signature in database
GPG key ID: 18D2767419676C87
4 changed files with 35 additions and 2 deletions

View file

@ -45,7 +45,7 @@ export const useDiscordRpc = () => {
state: (artists && `By ${artists}`) || 'Unknown artist',
// I would love to use the actual type as opposed to hardcoding to 2,
// but manually installing the discord-types package appears to break things
type: 2,
type: discordSettings.showAsListening ? 2 : 0,
};
if (currentStatus === PlayerStatus.PLAYING) {
@ -73,7 +73,13 @@ export const useDiscordRpc = () => {
}
discordRpc?.setActivity(activity);
}, [currentSong, currentStatus, discordSettings.enableIdle, discordSettings.showServerImage]);
}, [
currentSong,
currentStatus,
discordSettings.enableIdle,
discordSettings.showAsListening,
discordSettings.showServerImage,
]);
useEffect(() => {
const initializeDiscordRpc = async () => {

View file

@ -119,6 +119,29 @@ export const DiscordSettings = () => {
postProcess: 'sentenceCase',
}),
},
{
control: (
<Switch
checked={settings.showAsListening}
onChange={(e) => {
setSettings({
discord: {
...settings,
showAsListening: e.currentTarget.checked,
},
});
}}
/>
),
description: t('setting.discordListening', {
context: 'description',
postProcess: 'sentenceCase',
}),
isHidden: !isElectron(),
title: t('setting.discordListening', {
postProcess: 'sentenceCase',
}),
},
];
return <SettingsSection options={discordOptions} />;