Skip to content

Commit

Permalink
[common] Check for socket files
Browse files Browse the repository at this point in the history
  • Loading branch information
goldyfruit committed Nov 21, 2023
1 parent c821e61 commit 01be8b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ function detect_sound() {
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
# Detect if a PulseAudio socket exists either Linux or WSL2
if [ -e "/run/user/${RUN_AS_UID}/pulse/native" ]; then
if [ -S "/run/user/${RUN_AS_UID}/pulse/native" ] && [ ! -S "$PULSE_SOCKET_WSL2" ]; then
# When running on Linux
export PULSE_SERVER="/run/user/${RUN_AS_UID}/pulse/native"
elif [ -e "$PULSE_SOCKET_WSL2" ]; then
elif [ -S "$PULSE_SOCKET_WSL2" ]; then
# When running on WSL2
export PULSE_SERVER="$PULSE_SOCKET_WSL2"
fi
Expand Down

0 comments on commit 01be8b6

Please sign in to comment.