Improve code

This commit is contained in:
luk3yx 2022-07-10 11:27:02 +12:00
parent 79c8cf1516
commit 35e90c8c27

View File

@ -51,10 +51,9 @@ export LC_ALL="C.UTF-8"
# Make PulseAudio socket available inside the snap-specific $XDG_RUNTIME_DIR
# Code originally from https://github.com/ubuntu/snapcraft-desktop-helpers/blob/ec86125/common/desktop-exports#L257-L264
if [ -n "$XDG_RUNTIME_DIR" ]; then
pulsenative="pulse/native"
# $XDG_RUNTIME_DIR may not exist yet, use readlink to get the parent
# directory anyway.
pulseaudio_sockpath=$(readlink -m "$XDG_RUNTIME_DIR/../$pulsenative")
pulseaudio_sockpath=$(readlink -m "$XDG_RUNTIME_DIR/../pulse/native")
if [ -S "$pulseaudio_sockpath" ]; then
export PULSE_SERVER="unix:${pulseaudio_sockpath}"
fi