Add option to show playing icon in Discord RPC (#1699)

* feat: add option to show playing/paused icon in Discord RPC
This commit is contained in:
York
2026-02-12 13:14:58 +08:00
committed by GitHub
parent 91e7c7434c
commit 9cde569c7d
4 changed files with 45 additions and 4 deletions
+2
View File
@@ -788,6 +788,8 @@
"discordRichPresence_description": "enable playback status in {{discord}} rich presence. Image keys are: {{icon}}, {{playing}}, and {{paused}}",
"discordServeImage": "serve {{discord}} images from server",
"discordServeImage_description": "share cover art for {{discord}} rich presence from server itself, only available for Jellyfin and Navidrome. {{discord}} uses a bot to fetch images, so your server must be reachable from the public internet",
"discordStateIcon": "show playing icon",
"discordStateIcon_description": "show a small playing icon in the rich presence status. the paused icon is always shown when \"Show rich presence when paused\" is enabled",
"discordUpdateInterval": "{{discord}} rich presence update interval",
"discordUpdateInterval_description": "the time in seconds between each update (minimum 15 seconds)",
"enableAutoTranslation_description": "enable translation automatically when lyrics are loaded",
@@ -109,8 +109,18 @@ export const useDiscordRpc = () => {
instance: false,
largeImageKey: 'icon',
largeImageText: truncate(stationName || 'Radio'),
smallImageKey: current[2] === PlayerStatus.PLAYING ? 'playing' : 'paused',
smallImageText: sentenceCase(current[2]),
smallImageKey:
current[2] === PlayerStatus.PLAYING
? discordSettings.showStateIcon
? 'playing'
: undefined
: 'paused',
smallImageText:
current[2] === PlayerStatus.PLAYING
? discordSettings.showStateIcon
? sentenceCase(current[2])
: undefined
: sentenceCase(current[2]),
state: truncate(artist),
statusDisplayType: StatusDisplayType.STATE,
type: discordSettings.showAsListening ? 2 : 0,
@@ -199,7 +209,7 @@ export const useDiscordRpc = () => {
(song?.album && song.album.padEnd(2, ' ')) || 'Unknown album',
),
smallImageKey: undefined,
smallImageText: sentenceCase(current[2]),
smallImageText: undefined,
state: truncate((artists && artists.padEnd(2, ' ')) || 'Unknown artist'),
statusDisplayType: statusDisplayMap[discordSettings.displayType],
// I would love to use the actual type as opposed to hardcoding to 2,
@@ -247,9 +257,13 @@ export const useDiscordRpc = () => {
activity.endTimestamp = end;
}
activity.smallImageKey = 'playing';
if (discordSettings.showStateIcon) {
activity.smallImageKey = 'playing';
activity.smallImageText = sentenceCase(current[2]);
}
} else {
activity.smallImageKey = 'paused';
activity.smallImageText = sentenceCase(current[2]);
}
if (discordSettings.showServerImage && song) {
@@ -349,6 +363,7 @@ export const useDiscordRpc = () => {
[
discordSettings.showAsListening,
discordSettings.showServerImage,
discordSettings.showStateIcon,
discordSettings.showPaused,
lastfmApiKey,
discordSettings.clientId,
@@ -98,6 +98,28 @@ export const DiscordSettings = memo(() => {
postProcess: 'sentenceCase',
}),
},
{
control: (
<Switch
checked={settings.showStateIcon}
onChange={(e) => {
setSettings({
discord: {
showStateIcon: e.currentTarget.checked,
},
});
}}
/>
),
description: t('setting.discordStateIcon', {
context: 'description',
postProcess: 'sentenceCase',
}),
isHidden: !isElectron(),
title: t('setting.discordStateIcon', {
postProcess: 'sentenceCase',
}),
},
{
control: (
<Switch
+2
View File
@@ -261,6 +261,7 @@ const DiscordSettingsSchema = z.object({
showAsListening: z.boolean(),
showPaused: z.boolean(),
showServerImage: z.boolean(),
showStateIcon: z.boolean(),
});
const FontSettingsSchema = z.object({
@@ -986,6 +987,7 @@ const initialState: SettingsState = {
showAsListening: false,
showPaused: true,
showServerImage: false,
showStateIcon: true,
},
font: {
builtIn: 'Inter',