Mittwoch, 3. Dezember 2008

Volume mit amixer und xosd

aptitude install xosd-bin

Folgendes Script benutzen mit:
script_name.sh toggle
script_name.sh up
script_name.sh down
#!/bin/bash

ACTION="$1"
MIXER="Master"
VALUE="1"
FONT="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"

[ -z "${ACTION}" ] && echo "Usage: $0 [up|down|toggle]"

if [ "${ACTION}" == "up" ]; then
amixer sset ${MIXER} ${VALUE}+ unmute
elif [ "${ACTION}" == "down" ]; then
amixer sset ${MIXER} ${VALUE}- unmute
elif [ "${ACTION}" == "toggle" ]; then
amixer -q set ${MIXER} toggle
fi

killall osd_cat > /dev/null 2>&1
if [ "$(amixer sget $MIXER,0 | grep "off")" == "" ]; then
PERCENT=$(amixer sget $MIXER,0 | grep "Front Left:" | cut -d "[" -f2 | cut -d "%" -f1)
osd_cat -p bottom -A center -o 30 -b percentage -P ${PERCENT} -d 1
else
echo "MUTE" | osd_cat -f ${FONT} -p bottom -A center -o -120 -d 1
fi

Keine Kommentare: