#!/bin/sh
# This is an ugly hack to force audacious to select the correct output plugin, 
# avoiding pulseaudio if the server is not running, and using alsa instead

if [ -f ~/.config/audacious/config ]
then

if pgrep pulseaudio
then
sed -i s/ALSA/pulse_audio/g ~/.config/audacious/config
else
sed -i s/pulse_audio/ALSA/g ~/.config/audacious/config 
fi

fi

/usr/bin/audacious "$*"
