Skip to content

Instantly share code, notes, and snippets.

@IronOxidizer
Last active June 18, 2020 16:10
Show Gist options
  • Save IronOxidizer/06bd98459e9bb0b9d2de3b76fa0ca421 to your computer and use it in GitHub Desktop.
Save IronOxidizer/06bd98459e9bb0b9d2de3b76fa0ca421 to your computer and use it in GitHub Desktop.
Audio Flatpak

Thanks @CrashyBang and @KaMiila, your solutions worked wonderfully for my similar issue with Discord Flatpak. I'll detail my exact procedure for anyone else:

Step 1: Add the following lines to ~/.xinitrc (before the line that starts WM)

mkdir -p "$HOME/.cache/xdg_runtime_dir"
export XDG_RUNTIME_DIR="$HOME/.cache/xdg_runtime_dir"

Step 2: Create a script (mine is ~/.local/bin/Discord) with the following lines

#!/bin/sh
export xprop -root -notype PULSE_SERVER | tr -d ' '
PULSE_SERVER=unix:/tmp/pulse-PKdhtXMmr18n/native
flatpak run com.discordapp.Discord

Step 3: Change the permission on the script to make it runnable chmod a+x ~/.local/bin/Discord

Step 4: Restart/reload your WM and run the script. If Discord still has no sound the first time you run it after this procedure, kill all Discord processes (check htop) and try again. Sometimes xdg_runtime_dir is not populated before discord launches so it can't connect to PulseAudio but after restarting Discord, it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment