Skip to content

Commit

Permalink
[common] Use the correct PULSE_SERVER socket
Browse files Browse the repository at this point in the history
  • Loading branch information
goldyfruit committed Nov 21, 2023
1 parent 5c72ec4 commit 809dc3b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion utils/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ function detect_sound() {
# Looking for any pulse processes
if [[ "$(pgrep -a -f "pulse" | awk -F"/" '{ print $NF }' 2>>"$LOG_FILE")" =~ "pulse" ]]; then
# PULSE_SERVER is required by pactl as it is executed via sudo
export PULSE_SERVER="/run/user/${RUN_AS_UID}/pulse/native"
if [ -f "/run/user/${RUN_AS_UID}/pulse/native" ]; then
export PULSE_SERVER="/run/user/${RUN_AS_UID}/pulse/native"
elif [ -f "$PULSE_SOCKET_WSL2" ]; then
export PULSE_SERVER="$PULSE_SOCKET_WSL2"
fi
if command -v pactl &>>"$LOG_FILE"; then
SOUND_SERVER="$(pactl info | awk -F":" '$1 ~ /Server Name/ { print $2 }' | sed 's/^ *//')"
else
Expand Down

0 comments on commit 809dc3b

Please sign in to comment.