Repository navigation
Let addons read what's playing and put a card on your profile (GRYT-1637) - #746
Merged
Merged
Conversation
…637) Two new addon permissions, agreed to per addon like the others. media reads what the OS media controls say is playing: Windows' media session, MPRIS on Linux, and on macOS Spotify and Music asked directly, since macOS keeps its own Now Playing to Apple. activity lets an addon put a card like "Listening to" on your profile, on every server. Nothing reads the media controls unless an addon with media is on and listening, and a stopped addon's card comes down with it. The card goes through the same board as games, so a game still wins over it, and it works with Rich Presence off. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each permission gets a level: low only changes what you see, medium can show things about you to others, high can send data to the servers you're on. Settings shows the addon's riskiest level above its permissions, and each permission's own level beside it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sivert wanted "Listening to" as Gryt's first real addon. Addons run sandboxed and can't start programs, so the app reads the media controls and addons ask for them through permissions.
Two new addon permissions, agreed to per addon in Settings → Addons like the others:
media:gryt.media.current()andgryt.media.on(handler)(checked every 15 s while an addon listens). Windows reads its media session through PowerShell, Linux MPRIS throughgdbus, and macOS asks Spotify and Music with AppleScript, only while they're running, since macOS keeps its system Now Playing to Apple's own apps. macOS asks the person the first time.activity:gryt.activity.set({ type: "listening", name, details, state, startedAt })andgryt.activity.clear(). The main process checks every field. The card goes through the Rich Presence board, so a game still wins, and it works with Rich Presence off. A stopped addon's card comes down.Risk levels: every permission now has one. Low only changes what you see (display), medium can show things about you to others (status, activity, processes, media), high can send data to the servers you are on (messaging). Settings → Addons shows the addon's riskiest level as a badge above its permissions, and each permission's level beside it.
What to look at
scripts/check-now-playing.mjs: Windows JSON, MPRIS GVariant text, the osascript line). The PowerShell script and MPRIS calls haven't run on a real Windows or Linux machine yet.mediais on and listening.The addon itself comes next in its own repo, Gryt-chat/addon-now-playing.
🤖 Generated with Claude Code