-
-
Save cmavr8/1226520 to your computer and use it in GitHub Desktop.
Mute/Unmute microphone on a Lenovo X201s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Map this script to a button (eg F1) to mute your mic while VoIPing | |
currentlevel=`amixer get Capture |grep "Front Left:" | awk '{ print ($5) }'` | |
if [ $currentlevel == '[100%]' ]; then | |
amixer set Capture 0 | |
echo "Mic muted" >> /tmp/mutelog | |
elif [ $currentlevel == '[0%]' ]; then | |
amixer set Capture 100 | |
echo "Mic unmuted" >> /tmp/mutelog | |
else | |
echo "Bad mic value. Mic muted anyway for safety" >> /tmp/mutelog | |
amixer set Capture 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Improvement: just use this command:
amixer set Capture toggle
works on every ubuntu pc I tried, much better...