Skip to content

Instantly share code, notes, and snippets.

@Swipe650
Created June 30, 2018 08:06
Show Gist options
  • Save Swipe650/9f8aa6a46340a7fb0bccdd6375454818 to your computer and use it in GitHub Desktop.
Save Swipe650/9f8aa6a46340a7fb0bccdd6375454818 to your computer and use it in GitHub Desktop.
#!/bin/bash
current=$(pacmd list-sinks |grep active)
#switch to speakers
if [[ $current == *"headphones"* ]]; then
pacmd set-sink-port 0 analog-output-lineout
amixer -c 0 sset "Auto-Mute Mode" Disabled
#switch to headphones
elif [[ $current == *"lineout"* ]]; then
pacmd set-sink-port 0 analog-output-headphones
amixer -c 0 sset "Auto-Mute Mode" Enabled
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment