#!/bin/sh
#
# starts a the sound setting tool in a session for cases where no
# advanced activity is available (mini/whole DoudouLinux)
#
# Author: JM. Philippe <philipjm@free.fr>
#
# gamine-session is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# gamine-session is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with gamine-session.  If not, see <http://www.gnu.org/licenses/>.

# NB: WM list is restricted by deb package dependencies
WMLIST='openbox metacity kwin'
WMSTARTED=0

# try to start a WM
for WM in $WMLIST; do
	if [ -x "$(which $WM)" ]; then
		$WM &
		WMSTARTED=1
		break
	fi
done

# can now start sound setting tool or fail
if [ $WMSTARTED = 1 ]; then
	gnome-volume-control &
	set-alsa-output
else
	echo '! unable to start a window manager among' $WMLIST
fi
