Sophie

Sophie

distrib > Mandriva > 2007.0 > x86_64 > media > contrib-updates-src > by-pkgid > 89ffd2f8eef658b6b3fb13eba8d9626c > files > 1

qjackctl-0.2.21-3mdv2007.0.src.rpm

#!/bin/bash
# Neat script to make menu-driven life easier for apps requiring jack.
# Austin Acton, 2004.
# austin@mandrake.org

if [ $# = 0 ] || [ $1 = '-h' ] || [ $1 = '--help' ]
then
	echo "jackwrapper is used to verify that the jack daemon is running"
	echo "before launching an application that requires it."
	echo "If not, jackwrapper lauches qjackctl and asks the user to start"
	echo "the jack daemon before the main application is launched."
	echo "usage: jackwrapper <application>"
else	

# Check for various dialog types, prefer kde, then gnome, then X, then text. (Buchan Milne)

COMMAND="$TERM -e dialog"
[ -x "`which Xdialog 2>&-`" ] && COMMAND="Xdialog"
[ -x "`which gdialog 2>&-`" -a -n "$GNOME_DESKTOP_SESSION_ID" ] && COMMAND="gdialog"
[ -x "`which kdialog 2>&-`" -a "$DESKTOP" == "kde" ] && COMMAND="kdialog"

# Main works like this:
# 1. If jackd running, just start application (keep expert/cli users happy).
# 2. If not, check for (and run) qjackctl, and tell the user to start jack with it.
#    Then wait for OK, then run application.

if [ "`ps -A | grep 'jackd'`" != "" ]
then
	exec $1
else
	if [ "`ps -A | grep 'qjackctl'`" != "" ]
	then
		$COMMAND --title "Launching $1" --yesno "Please use the other window to configure and start the JACK Audio Connection Kit.  Then choose OK/Yes to start $1." 0 0 && exec $1
	else
		qjackctl&
		sleep 1
		$COMMAND --title "Launching $1" --yesno "Please use the other window to configure and start the JACK Audio Connection Kit.  Then choose OK/Yes to start $1." 0 0 && exec $1
	fi
fi
										fi