FichteFoll / discordrp-mpris

Discord Rich Presence through media players providing the mpris2 dbus interface
MIT License
86 stars 19 forks source link

Discord Flatpak #17

Closed Atrate closed 3 years ago

Atrate commented 3 years ago

Hey there!

I think it may be useful if the README included instruction on how to make Discord connect to drp-mpris when Discord is installed through Flatpak.

Atrate

FichteFoll commented 3 years ago

If someone who uses discord vial flatpak would provide some instructions or submit them as a pull request, I would be glad to add that.

Atrate commented 3 years ago

I use Discord through Flatpak and have so far had no success getting it to work.

Background: Flatpak does not let processes discover other running processes, and there is no workaround: https://github.com/flathub/com.discordapp.Discord/issues/11 .

It is possible to allow a Flatpak application to access the following features, though:

As well as specified names on the system and session buses (divided by "talks" and "owns).

So far, I've enabled Discord to use IPC, the Session and System buses and I've had no luck. What name does drp-mpris use on the session/system bus?

FichteFoll commented 3 years ago

We communicate with Discord over the UNIX Domain Socket it provides in a temporary directory.

https://github.com/FichteFoll/discordrp-mpris/blob/bef1f306fcfbb8f88c2c89d4851e6581db4f2bbe/discord_rpc/async_.py#L216-L224

I'm not aware of any other mechanism of communication that Discord exposes currently, but I also haven't revisited this topic in a while.

Atrate commented 3 years ago

The Discord Socket when Discord is ran in Flatpak can be found here:

$XDG_RUNTIME_DIR/app/com.discordapp.Discord/discord-ipc-0

Update: creating a symlink from $XDG_RUNTIME_DIR/app/com.discordapp.Discord/discord-ipc-0 to $XDG_RUNTIME_DIR/discord-ipc-0 works, so getting drp-mpris to recognize the first path should also work.

I can try creating a PR for that, but I am not too experienced with Python.

FichteFoll commented 3 years ago

That's fine, I can work with this. I need to add snap support as well, as I have done somewhere else already.