Bitcoin donations are welcome:14snQXeLcnJtWUduKZ6rC2MHdPYrYar1Tw

Sunday, June 2, 2013

Linux script to mute and unmute both Master and PCM

Updated my debian distro recently, and trying to make amixer mute and unmute only the Master channel caused some problems. Why do I use this cmd for this job? Because I'm linking my multimedia buttons to amixer to mute and unmute my audio.

Created a bash script called mute, which I put in /usr/bin/mute and chmod 755. It looks like this:

if amixer get Master|grep off; then
amixer set Master,0 unmute
amixer set PCM,0 unmute
notify-send "[ ] Mute"
else
amixer set Master,0 mute
amixer set PCM,0 mute
notify-send "[X] Mute"
fi

You can of course decide to remove the "notify-send" cmd, if you don't want any notifications.

No comments:

Post a Comment