Skip to content

Rich Precense (discord rpc)

Patrick edited this page May 18, 2022 · 12 revisions

Due to how flatpak sandboxing works, we cannot export Discord RP socket under it's default path, so it's exported under different one. See #29 for details. The work is already done in the Discord Flathub package, this is meant for application who want to talk to Discord.

Unsandboxed applications

Run ln -sf $XDG_RUNTIME_DIR/{app/com.discordapp.Discord,}/discord-ipc-0 to make Discord RPC available to apps which expect the normal location.

You can make this permanent with:

mkdir -p ~/.config/user-tmpfiles.d
echo 'L %t/discord-ipc-0 - - - - app/com.discordapp.Discord/discord-ipc-0' > ~/.config/user-tmpfiles.d/discord-rpc.conf
systemctl --user enable --now systemd-tmpfiles-setup.service

Flatpak applications

Flatpak applications need certain changes inside of the flatpak environment to connect up properly :

  1. Permission to access $XDG_RUNTIME_DIR/app/com.discordapp.Discord/
  2. A symlink at $XDG_RUNTIME_DIR/discord-ipc-0 pointing to $XDG_RUNTIME_DIR/app/com.discordapp.Discord/discord-ipc-0

Ask the applications maintainers to do this, don't do it yourself to ensure you continue to get updates.

Suggested changes to accomplish these needs :

  1. Add --filesystem=xdg-run/app/com.discordapp.Discord:create to finish-args
  2. Create a wrapper (if you don't already have one) for the apps binary and add something like this
    for i in {0..9}; do
        test -S $XDG_RUNTIME_DIR/discord-ipc-$i || ln -sf {app/com.discordapp.Discord,$XDG_RUNTIME_DIR}/discord-ipc-$i;
    done
Clone this wiki locally