Hallo,
dieses Skript sollte das richtige für dich sein, stammt aus dem ArchLinux-Forum (genauen Link habe ich nicht mehr)
#!/bin/sh
# created by abarilla
# modified by wujaklija
usage="usage: $0 [-c up|down|mute] [-i increment] [-m mixer]"
command=
increment=
mixer=
while getopts "c:i:m:h" o
do case "$o" in
c) command=$OPTARG;;
i) increment=$OPTARG;;
m) mixer=$OPTARG;;
h) echo "$usage"; exit 0;;
?) echo "$usage"; exit 0;;
esac
done
if [[ -z $command ]] || [[ -z $increment ]] || [[ -z $mixer ]]
then
echo $usage
exit 1
fi
#shift $(($OPTIND - 1))
#command=$1
#if [ "$command" = "" ]; then
# echo "usage: $0 {up|down|mute} [increment]"
# exit 0;
#fi
display_volume=0
echo "$mixer"
if [ "$command" = "up" ]; then
display_volume=$(amixer set $mixer $increment+ unmute | grep -m 1 "%]" | cut -d "[" -f2|cut -d "%" -f1)
amixer set PCM $increment+ unmute
fi
if [ "$command" = "down" ]; then
display_volume=$(amixer set $mixer $increment- unmute | grep -m 1 "%]" | cut -d "[" -f2|cut -d "%" -f1)
amixer set PCM $increment- unmute
fi
icon_name=""
if [ "$command" = "mute" ]; then
if amixer get Master | grep "\[on\]"; then
display_volume=0
icon_name="notification-audio-volume-muted"
amixer set $mixer mute
else
display_volume=$(amixer set $mixer unmute | grep -m 1 "%]" | cut -d "[" -f2|cut -d "%" -f1)
fi
fi
if [ "$icon_name" = "" ]; then
if [ "$display_volume" = "0" ]; then
icon_name="notification-audio-volume-off"
else
if [ "$display_volume" -lt "33" ]; then
icon_name="notification-audio-volume-low"
else
if [ "$display_volume" -lt "67" ]; then
icon_name="notification-audio-volume-medium"
else
icon_name="notification-audio-volume-high"
fi
fi
fi
fi
#notify-send -u normal -t 100 "$mixer"
notify-send "Volume" -i $icon_name -h int:value:$display_volume -h string:synchronous:volume
#notify-send "$mixer" -i $icon_name
usage: /usr/bin/vol.sh [-c up|down|mute] [-i increment] [-m mixer]