Skip to main content

Discord

Discord is a proprietary, cross-platform, all-in-one voice and text chat application.

Install Discord from the repositories:

pacman -S discord 

Or the official Flatpak app:

flatpak install com.discordapp.Discord

Rich Presence with Flatpak

Discord provides a Unix socket file that games and applications use in order to show what game or media is currently being played.

The Flatpak version creates this socket in a different location than the repo package version. In order for games and apps to still be able to communicate with the Discord app, a symbolic link needs to be created in the usual place, pointing to the location of the socket file of the Flatpak version.

systemd-tmpfiles can be used to automatically create this link upon logging into the desktop session.

Create the directory user-tmpfiles.d in your user's .config directory:

mkdir -p ~/.config/user-tmpfiles.d

In the newly created directory, create a new config file:

nano discord-ipc.conf

systemd-tmpfiles uses the information in the config file to create temporary files as long as the user is logged in and remove them once the user logs out.

The fields in this file are space separated. The fields are as follows:

Field Description
Type The type of file to create. L = symbolic link, d = directory, f = regular file.
Path Path where to create the object. %t = signifier for user-specific temporary directory.
Mode File permissions in octal notation. - means keep the default.
Owner User who will own the file. - means keep the default.
Group Group who will own the file. - means keep the default.
Time Expiration time of the file, e.g. 2h deletes the files after 2 hours. - means no expiration time.
Options Parameters specific to the type used in the type field. When L, it's the target the link will point to.

In order for the link to point to the Discord socket of the Flatpak version, the resulting config file looks like this:

L %t/discord-ipc-0 - - - - app/com.discordapp.Discord/discord-ipc-0

This will create a symbolic link at /run/user/1000/discord-ipc-0 pointing to the actual socket file at /run/user/1000/app/app/com.discordapp.Discord/discord-ipc-0 where the Flatpak version of Discord is listening on incoming connections from other apps and games.

systemd-tmpfiles will not automatically pick up on the new config file automatically. Either log out and log back in to trigger the systemd-tmpfiles user unit, or run systemd-tmpfiles --user --create manually to have systemd-tmpfiles create the link.