Created
May 21, 2017 07:53
-
-
Save n1trux/001639ec2716fbd46c0005f1ca93fac1 to your computer and use it in GitHub Desktop.
toggle automute for specific alsa card
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/sh | |
# card name | |
CARD=`sed -n 's/\s\([0-9]*\).*:\s.*Intel PCH/\1/p' /proc/asound/cards` | |
# check auto-mute state | |
amixer -c $CARD sget "Auto-Mute Mode" | grep "Item0: 'Disabled'" | |
# $? is 0 if auto-mute is disabled | |
# $? is 1 if auto-mute is enabled | |
if [ "$?" -eq "0" ]; then | |
amixer -c $CARD sset "Auto-Mute Mode" Enabled | |
notify-send 'auto-mute enabled' -u low -a ALSA -t 4000 -i audio-volume-muted | |
else | |
amixer -c $CARD sset "Auto-Mute Mode" Disabled | |
notify-send 'auto-mute disabled' -u low -a ALSA -t 4000 -i audio-volume-high | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment