Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@n1trux
Created May 21, 2017 07:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n1trux/001639ec2716fbd46c0005f1ca93fac1 to your computer and use it in GitHub Desktop.
Save n1trux/001639ec2716fbd46c0005f1ca93fac1 to your computer and use it in GitHub Desktop.
toggle automute for specific alsa card
#!/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