#!/bin/sh

# Load the module until it fails
while pactl load-module module-detect; do
  :
done


if [ "$DISPLAY" = ":0" ]; then
  if ! pactl set-default-sink alsa_output.0.hdmi-stereo; then
    pactl set-default-sink alsa_output.1.hdmi-stereo
  fi
  echo "$DISPLAY set audio"
elif [ "$DISPLAY" = ":10.0" ]; then
  pactl set-default-sink xrdp-sink
  echo "$DISPLAY set audio"
else
    echo "The DISPLAY variable is set to: $DISPLAY, but not to :0 or :10.0"
fi
