i3conf/bin/sound.sh

23 lines
722 B
Bash
Executable File

#!/bin/sh
# control for the mute key, toggles mute/unmute
if [ $1 = '-m' ]; then
mutecontrol=$(amixer get Master | grep 'Front Left:' | awk '{ print $6 }')
if [ $mutecontrol = "[on]" ]; then
amixer set Master mute
notify-send "Sound muted."
elif [ $mutecontrol = "[off]" ]; then
amixer set Master unmute
notify-send "Sound unmuted."
fi
elif [ $1 = "-d" ]; then
amixer set Master 10%-
volume=$(amixer get Master |grep 'Front Left:' |awk '{ print $5 }' |sed -e 's/\[\(.*\)\]/\1/')
notify-send "Sound lowered to $volume"
elif [ $1 = "-u" ]; then
amixer set Master 10%+
volume=$(amixer get Master |grep 'Front Left:' |awk '{ print $5 }' |sed -e 's/\[\(.*\)\]/\1/')
notify-send "Sound raised to $volume"
fi