Make something like Discord Rich Presence

(#927) Feature Planned profiles

Thread

Comment by @PhrolovaMoe
RexSystem 1 vote originally by @PhrolovaMoe on GitHub 4 replies
Discord just opens a unix domain socket (or multiple, 0-9) at $XDG_RUNTIME_DIR, which apps that have RPC support hook into. each message is a header (opcode as uint32LE + length as uint32LE) followed by a JSON payload. on top of this, Discord on Linux periodically scans /proc for processes and matches them against a database for automatic matching the opcodes are: 0 for handshake, 1 for frame (for setting activity, etc.), 2 for close, 3 for ping, and 4 for pong for maximum compatibility, we probably want to mimic what Discord does with its unix sockets, but this would prevent you from using Fluxer and Discord at the same time here's an example:
$ eza $XDG_RUNTIME_DIR | grep -i discord-ipc

discord-ipc-0
if this is a desired feature, I can try implementing it
Comment by @az-z31
RexSystem 1 vote originally by @az-z31 on GitHub
Why would mimicking Discord’s IPC necessarily prevent simultaneous usage? Couldn’t you namespace the socket instead of reusing discord-ipc-0?
Comment by @PhrolovaMoe
RexSystem 1 vote originally by @PhrolovaMoe on GitHub
you can have 10 sockets at once, but apps hook into the first free socket. if an app hooks into Discord's socket first, we can't do anything about it. if the user disabled RPC in Discord though, it could work Fluxer could have it's own sockets as well (fluxer-ipc-{0..9}), it's just that most apps won't implement RPC for Fluxer
Comment by @Dontknow09
RexSystem 1 vote originally by @Dontknow09 on GitHub
Why would mimicking Discord’s IPC necessarily prevent simultaneous usage? Couldn’t you namespace the socket instead of reusing discord-ipc-0?
Because using the same sockets as discord can ensure backwards compatibility with older games that will never add fluxer specific rpc.
for maximum compatibility, we probably want to mimic what Discord does with its unix sockets, but this would prevent you from using Fluxer and Discord at the same time
sorry if I know little about this but, can't we just intercept or read from the same socket as discord?
Comment by @Wdboyes13
RexSystem 1 vote originally by @Wdboyes13 on GitHub
yeah i was thinking that intercepting socket traffic targetted for discord and if discord is not open, creating that socket from fluxer, so that apps that support discord rpc automatically support fluxer.