Skip to content

Instantly share code, notes, and snippets.

@nivit
Created January 16, 2022 17:17
Show Gist options
  • Save nivit/32465f934fac782c255ef0c019e2a25f to your computer and use it in GitHub Desktop.
Save nivit/32465f934fac782c255ef0c019e2a25f to your computer and use it in GitHub Desktop.
#!/bin/sh
chroot_path=/compat/ubuntu
get_pa_sock_path()
{
PA_SOCK_PATH=$(sockstat | awk -v me=$(whoami) -F'[ \t]+' '
$1 == me && $2 == "pulseaudio" && $6 ~ /native/ {
print $6;
exit 0
}'
)
}
get_pa_sock_path
if [ ! -S "$PA_SOCK_PATH" ]; then
while killall pulseaudio; do
sleep 0.5
done
pulseaudio --start
get_pa_sock_path
fi
[ -S "$PA_SOCK_PATH" ] && export PULSE_SERVER=unix:$PA_SOCK_PATH
${chroot_path}/usr/bin/spotify
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment