/usr/bin/kmixremote is in kmix 4:16.08.0-1+b1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | #!/bin/sh
#################################################################################
# kmixremote - control kmix from a script.
#
# Set volume
# Get volume
# Mute
#################################################################################
usage()
{
echo "Usage:"
echo "List mixers # $0 list"
echo "List controls # $0 list <mixer>"
echo "Get Volume # $0 get [--master | <mixer> <control>]"
echo "Set Volume # $0 set [--master | <mixer> <control>] <0..100>"
echo "Mute/Unmute # $0 mute [--master | <mixer> <control>] true|false"
echo
}
exit_with_error()
{
echo "Error: $1"
echo
usage
exit 1
}
# Prints the mixer DBUS ID's on the console. leaving out the "/Mixers/" prefix
listMixers()
{
qdbus org.kde.kmix /Mixers org.freedesktop.DBus.Properties.Get org.kde.KMix.MixSet mixers | cut -f3 -d/
errorCode=$?
if test $errorCode != 0; then
echo "Error $errorCode listing mixers. KMix is not running."
fi
}
# Prints the mixer control DBUS ID's of the given mixer on the console. leaving out the "/Mixers/" prefix
listControls()
{
qdbus org.kde.kmix $1 org.freedesktop.DBus.Properties.Get org.kde.KMix.Mixer controls | cut -f4 -d/
errorCode=$?
if test $errorCode != 0; then
echo "Error $errorCode listing controls. KMix is not running."
fi
}
command=""
if ! type qdbus >/dev/null 2>&1 ; then
exit_with_error "$0 requires qdbus, but it cannot be found. Please install or check \$PATH"
fi
# Read args
while true; do
arg=$1
if test -z "$arg"; then
break
fi
shift
if test "x--master" = "x$arg"; then
mixer=`qdbus org.kde.kmix /Mixers org.kde.KMix.MixSet.currentMasterMixer`
control=`qdbus org.kde.kmix /Mixers org.kde.KMix.MixSet.currentMasterControl`
elif test "x--help" = "x$arg" -o "x-h" = "x$arg"; then
usage
exit 0
else
# If not a specific option, then interpret as standad args, in this order: command, mixer, control and genericArg
if test -z "$command"; then
command=$arg
elif test -z "$mixer"; then
mixer="${arg}"
elif test -z "$control"; then
control=$arg
elif test -z "$genericArg"; then
genericArg=$arg
else
exit_with_error "Too many aguments"
fi
fi
#echo $arg
done
if test -z "$command"; then
usage
echo "<mixer> - The mixer to use. Select one from the following list:"
echo "-----------------------------------------------------------------"
listMixers
exit 0
elif test "xlist" = "x$command"; then
if test -z "$mixer"; then
listMixers
else
# List controls
listControls "/Mixers/${mixer}"
fi
exit 0
fi
# All following commands require a mixer
if test -z "$mixer"; then
exit_with_error "<mixer> argument missing"
fi
if test -z "$control"; then
exit_with_error "<control> argument missing"
fi
# All following commands require a mixer and a control
targetControl="/Mixers/${mixer}/${control}"
#echo "ARGS: $command $targetControl $genericArg"
# --- EXECUTE PHASE --------------------------------------------------------------------------------------------------
if test "xget" = "x$command"; then
# GET
qdbus org.kde.kmix $targetControl org.freedesktop.DBus.Properties.Get org.kde.KMix.Control volume
elif test "xset" = "x$command"; then
# SET
qdbus org.kde.kmix $targetControl org.freedesktop.DBus.Properties.Set org.kde.KMix.Control volume $genericArg
elif test "xmute" = "x$command"; then
# MUTE
qdbus org.kde.kmix $targetControl org.freedesktop.DBus.Properties.Set org.kde.KMix.Control mute $genericArg
else
exit_with_error "No such command '$command'"
fi
exit 0
|