Created
June 19, 2015 08:29
-
-
Save zviryatko/642497fd7578e7367a1c to your computer and use it in GitHub Desktop.
Switch PulseAudio master channel between multiple sound cards
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/bash | |
# Switch PulseAudio master channel between multiple sound cards | |
ENABLED=$(pacmd list-sinks | grep -A1 '* index' | grep 'name' | awk '{print $2}' | tr -d '<->') | |
DEVICE=$(pacmd list-sinks | grep 'name:' | awk '{print $2}' | tr -d '<->' | grep -v $ENABLED) | |
pactl set-default-sink $DEVICE | |
pactl set-default-source "$DEVICE.monitor" | |
INPUTS=($(pacmd list-sink-inputs | grep index | awk '{print $2}')) | |
for i in ${INPUTS[*]}; do pacmd move-sink-input $i $DEVICE &> /dev/null; done | |
qdbus org.kde.kmix /Mixers org.kde.KMix.MixSet.setCurrentMaster "PulseAudio::Playback_Devices=:1" "$DEVICE" 2>&1 > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment