Skip to content

Instantly share code, notes, and snippets.

@auroracramer
Last active July 11, 2022 21:06
Show Gist options
  • Save auroracramer/1f2801581a112e3a64159ef2456bada8 to your computer and use it in GitHub Desktop.
Save auroracramer/1f2801581a112e3a64159ef2456bada8 to your computer and use it in GitHub Desktop.
Startup script muting audio when you plug/unplug headphones so you don't blow out your eardrums
#!/bin/bash
acpi_listen | while IFS= read -r line; do
if [ "$line" = "jack/headphone HEADPHONE plug" ]
then
pactl -- set-sink-volume 0 20%
amixer -D pulse set Master mute
elif [ "$line" = "jack/headphone HEADPHONE unplug" ]
then
pactl -- set-sink-volume 0 20%
amixer -D pulse set Master mute
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment