flathub / com.valvesoftware.Steam

https://flathub.org/apps/details/com.valvesoftware.Steam
336 stars 70 forks source link

Discord RPC Concept #797

Open rowbawts opened 2 years ago

rowbawts commented 2 years ago

Hello everybody let me start of by saying the Discord RPC IS working with Linux native games that use the Linux native Discord SDK libs. However games that bundle this library but run through Proton (Wine) do NOT work. If the methods list below are unable to work in the Flatpak environment just say so but I thought I'd bring these projects to your attention in case they CAN be worked in as it would be really nice to see.

I've tried setting up the latter but no dice.

https://github.com/0e4ef622/wine-discord-ipc-bridge

https://github.com/mellowagain/rpc-wine

You can also see an example on how the former would be setup in a non-Flatpak environment below.

https://www.reddit.com/r/linux_gaming/comments/mcy80d/enabling_discord_rpc/

gasinvein commented 2 years ago

Just to clarify, which combinations of flatpak/non-flatpak Steam and Discord did you test? In general, RPC in flatpak'ed Discord is expected to work only with flatpak'ed Steam, and vice versa.

The main difference between flatpak and non-flatpak Discord RPC is the socket location. In non-flatpak, it's at $XDG_RUNTIME_DIR/discord-ipc-0, while in flatpak'ed Descord the socket is exported at $XDG_RUNTIME_DIR/app/com.discordapp.Discord/discord-ipc-0. The projects you mentioned could be patched to support flatpak'ed Discord RPC socket location, but it shouldn't be needed for this Steam flatpak app - it already has a workaround that adds symlink to the socket usual location upon Steam launch.

gasinvein commented 2 years ago

Also a list of games that use Discord PRC would be helpful, so we can test it.

rowbawts commented 2 years ago

Well to clarify I'm only using Flatpak Steam with Flatpak Discord. I'm running Silverblue so all my testing is exclusively Flatpak to Flatpak. And for the games I tried, Vengeance has Linux native Discord RPC support and that works and shows on Discord. But when I try a Proton (Wine) game with known Discord RPC support it doesn't work (Squad).

But for your testing purposes Splitgate has DiscordRPC support only in the Windows depot so you can use that to test since it's free.

gasinvein commented 2 years ago

So, did you try the projects you mentioned? Is so, can you provide exact steps you did to run a game with one of these projects?

rowbawts commented 2 years ago

So, did you try the projects you mentioned? Is so, can you provide exact steps you did to run a game with one of these projects?

I tried setting up the rpc-wine project with the instructions shown in the reddit post I linked, But I don't think it works because its trying to use the default Discord IPC Socket path which the Flatpak isn't using which can be seen here https://github.com/mellowagain/rpc-wine/blob/master/src/connections/connection.cc#L49

gasinvein commented 2 years ago

This Steam flatpak app symlinks Discord sockets back to their usual locations, so it should work given you launch the game after Steam Client (and this is probably the reason why Discord PR works in native games without any additional tricks).

rowbawts commented 2 years ago

This Steam flatpak app symlinks Discord sockets back to their usual locations, so it should work given you launch the game after Steam Client (and this is probably the reason why Discord PR works in native games without any additional tricks).

Hmm maybe the games I tested just don't work then.