Skip to content

Instantly share code, notes, and snippets.

@rogerzanoni
Last active February 2, 2018 16:28
Show Gist options
  • Save rogerzanoni/4e83a70a29dc26ad5bf946ad0c2d35fc to your computer and use it in GitHub Desktop.
Save rogerzanoni/4e83a70a29dc26ad5bf946ad0c2d35fc to your computer and use it in GitHub Desktop.
#!/bin/sh
acpi_listen | while IFS= read line
do
if [ "$line" == "jack/headphone HEADPHONE plug" ]; then
echo "Headphone plugged, muting HDMI output..."
amixer -c 0 -d 3 set Master mute
elif [ "$line" == "jack/headphone HEADPHONE unplug" ]; then
echo "Headphone unplugged, turning HDMI output on..."
amixer -c 0 -d 3 set Master unmute
elif [ "$line" == "jack/lineout LINEOUT plug" ]; then
echo "HDMI output plugged, muting jack output..."
amixer -c 0 -d 0 set Master mute
elif [ "$line" == "jack/lineout LINEOUT unplug" ]; then
echo "HDMI output unplugged, turning headphone output on..."
amixer -c 0 -d 0 set Master unmute
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment