From 9cde569c7da1e81f9b62adba24a14c4117439f60 Mon Sep 17 00:00:00 2001 From: York Date: Thu, 12 Feb 2026 13:14:58 +0800 Subject: [PATCH] Add option to show playing icon in Discord RPC (#1699) * feat: add option to show playing/paused icon in Discord RPC --- src/i18n/locales/en.json | 2 ++ .../features/discord-rpc/use-discord-rpc.ts | 23 +++++++++++++++---- .../components/window/discord-settings.tsx | 22 ++++++++++++++++++ src/renderer/store/settings.store.ts | 2 ++ 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index fbf541aa6..7ff025f55 100755 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -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", diff --git a/src/renderer/features/discord-rpc/use-discord-rpc.ts b/src/renderer/features/discord-rpc/use-discord-rpc.ts index fdcd7d9cd..63a81703a 100644 --- a/src/renderer/features/discord-rpc/use-discord-rpc.ts +++ b/src/renderer/features/discord-rpc/use-discord-rpc.ts @@ -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, diff --git a/src/renderer/features/settings/components/window/discord-settings.tsx b/src/renderer/features/settings/components/window/discord-settings.tsx index 3c3cf7759..29b0f39d4 100644 --- a/src/renderer/features/settings/components/window/discord-settings.tsx +++ b/src/renderer/features/settings/components/window/discord-settings.tsx @@ -98,6 +98,28 @@ export const DiscordSettings = memo(() => { postProcess: 'sentenceCase', }), }, + { + control: ( + { + setSettings({ + discord: { + showStateIcon: e.currentTarget.checked, + }, + }); + }} + /> + ), + description: t('setting.discordStateIcon', { + context: 'description', + postProcess: 'sentenceCase', + }), + isHidden: !isElectron(), + title: t('setting.discordStateIcon', { + postProcess: 'sentenceCase', + }), + }, { control: (