[PR #605] Add discord rpc #617

Open
opened 2026-02-28 14:33:39 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jpochyla/psst/pull/605
Author: @ThePotato97
Created: 4/25/2025
Status: 🔄 Open

Base: mainHead: discord-rpc


📝 Commits (10+)

  • 2bd6566 Add discord rpc
  • b817a95 Prevent discord rpc from blocking main thread
  • 8c76589 discord rpc ui/config stuff
  • b4a0fa5 change to discord app id instead of client id
  • df9df9a fix edge case with app id state
  • d709f7b add support for podcasts
  • 4b414c8 added taplo.toml
  • d7ef8b3 Remove new lines
  • 2a096de change all logs to lowercase
  • e3fa164 removed unused crate

📊 Changes

11 files changed (+476 additions, -3 deletions)

View changed files

.taplo.toml (+2 -0)
📝 Cargo.lock (+95 -1)
📝 psst-core/Cargo.toml (+1 -0)
psst-core/src/discord_rpc.rs (+177 -0)
📝 psst-core/src/error.rs (+2 -0)
📝 psst-core/src/lib.rs (+1 -0)
📝 psst-gui/Cargo.toml (+1 -0)
📝 psst-gui/src/controller/playback.rs (+153 -0)
📝 psst-gui/src/data/config.rs (+4 -0)
📝 psst-gui/src/ui/preferences.rs (+35 -0)
📝 psst-gui/src/webapi/client.rs (+5 -2)

📄 Description

closes #186

Add Discord Rich Presence (RPC) Support

This adds basic support for Discord Rich Presence to psst.

If you enable it and provide a valid Discord Application ID, the app will connect to your running Discord client and show the currently playing track in your profile.


Changes

  • Added a new discord_rpc.rs module under psst-core to manage the Discord RPC connection in a background thread.
  • Added discord-presence as a new dependency.
  • Extended the user configuration with two new fields:
    • discord_rpc_enable (bool)
    • discord_rpc_app_id (string)
  • Updated the Preferences UI with:
    • A checkbox to enable/disable Discord RPC.
    • A text field for entering your Discord App ID.
    • A button linking to Discord Developer Portal if you need to create one.
  • Hooked the RPC updates into the PlaybackController:
    • Starts the RPC client when enabled (and app ID is valid).
    • Updates it live if the App ID changes.
    • Shuts it down cleanly when disabled or when quitting.

Behavior

  • Nothing happens unless the user explicitly enables the feature.
  • Invalid App IDs are rejected cleanly with warnings.
  • If playback changes (play, pause, seek, next track), the Discord status updates automatically.
  • Disconnects and clears the Discord status when pausing or stopping playback.

Notes

  • Only one new real dependency was added: discord-presence.
  • Defaults are safe: Discord RPC is disabled by default.

Screenshots

image
image


Why

Because Discord status is cool
and now people can see what garbage music you're listening to in real time.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/jpochyla/psst/pull/605 **Author:** [@ThePotato97](https://github.com/ThePotato97) **Created:** 4/25/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `discord-rpc` --- ### 📝 Commits (10+) - [`2bd6566`](https://github.com/jpochyla/psst/commit/2bd65662a0fdf3c8e6db0e42fc64f03bfacdf8e3) Add discord rpc - [`b817a95`](https://github.com/jpochyla/psst/commit/b817a951618a2f1d5c0601e8a11c0017b63ebdc3) Prevent discord rpc from blocking main thread - [`8c76589`](https://github.com/jpochyla/psst/commit/8c7658987f11c992fa94ffc9777d32784ca6b419) discord rpc ui/config stuff - [`b4a0fa5`](https://github.com/jpochyla/psst/commit/b4a0fa56046a214ff4c3a882fc056202b799bba5) change to discord app id instead of client id - [`df9df9a`](https://github.com/jpochyla/psst/commit/df9df9aa77274fed918c4d8cb5f8826542db8c13) fix edge case with app id state - [`d709f7b`](https://github.com/jpochyla/psst/commit/d709f7bf39442427693c5d35428f31e8d941a5e5) add support for podcasts - [`4b414c8`](https://github.com/jpochyla/psst/commit/4b414c8b818d5e3de2b1119b72a1ebeafad2e2b2) added taplo.toml - [`d7ef8b3`](https://github.com/jpochyla/psst/commit/d7ef8b3dd7905ac62563990e2cc9504404af2099) Remove new lines - [`2a096de`](https://github.com/jpochyla/psst/commit/2a096de8189f2a3e051100956da6bea5a3e1b20d) change all logs to lowercase - [`e3fa164`](https://github.com/jpochyla/psst/commit/e3fa1645077e7b69350e040ea10d769317f81772) removed unused crate ### 📊 Changes **11 files changed** (+476 additions, -3 deletions) <details> <summary>View changed files</summary> ➕ `.taplo.toml` (+2 -0) 📝 `Cargo.lock` (+95 -1) 📝 `psst-core/Cargo.toml` (+1 -0) ➕ `psst-core/src/discord_rpc.rs` (+177 -0) 📝 `psst-core/src/error.rs` (+2 -0) 📝 `psst-core/src/lib.rs` (+1 -0) 📝 `psst-gui/Cargo.toml` (+1 -0) 📝 `psst-gui/src/controller/playback.rs` (+153 -0) 📝 `psst-gui/src/data/config.rs` (+4 -0) 📝 `psst-gui/src/ui/preferences.rs` (+35 -0) 📝 `psst-gui/src/webapi/client.rs` (+5 -2) </details> ### 📄 Description closes #186 # Add Discord Rich Presence (RPC) Support This adds basic support for Discord Rich Presence to psst. If you enable it and provide a valid Discord Application ID, the app will connect to your running Discord client and show the currently playing track in your profile. --- ### Changes - Added a new `discord_rpc.rs` module under `psst-core` to manage the Discord RPC connection in a background thread. - Added `discord-presence` as a new dependency. - Extended the user configuration with two new fields: - `discord_rpc_enable` (bool) - `discord_rpc_app_id` (string) - Updated the Preferences UI with: - A checkbox to enable/disable Discord RPC. - A text field for entering your Discord App ID. - A button linking to [Discord Developer Portal](https://discord.com/developers/applications) if you need to create one. - Hooked the RPC updates into the `PlaybackController`: - Starts the RPC client when enabled (and app ID is valid). - Updates it live if the App ID changes. - Shuts it down cleanly when disabled or when quitting. --- ### Behavior - Nothing happens unless the user explicitly enables the feature. - Invalid App IDs are rejected cleanly with warnings. - If playback changes (play, pause, seek, next track), the Discord status updates automatically. - Disconnects and clears the Discord status when pausing or stopping playback. --- ### Notes - Only one new real dependency was added: `discord-presence`. - Defaults are safe: Discord RPC is disabled by default. ### Screenshots ![image](https://github.com/user-attachments/assets/4f916ea3-7da2-4ba9-9828-ae99a54a9f79) ![image](https://github.com/user-attachments/assets/19cfd3be-7708-49e0-9aed-5d65af34901f) --- # Why Because Discord status is cool and now people can see what garbage music you're listening to in real time. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/psst#617
No description provided.