Skip to content

Instantly share code, notes, and snippets.

@rpxio
Created April 23, 2019 22:43
Show Gist options
  • Save rpxio/bc72b377047da917200f005dba81e8d9 to your computer and use it in GitHub Desktop.
Save rpxio/bc72b377047da917200f005dba81e8d9 to your computer and use it in GitHub Desktop.
audio toggle
#!/bin/bash
new_sink=$(pacmd list-sinks | grep index | tee /dev/stdout | grep -m1 -A1 "* index" | tail -1 | cut -c12-)
echo "Setting default sink to: $new_sink";
pacmd set-default-sink $new_sink
pacmd list-sink-inputs | grep index | while read line
do
echo "Moving input: ";
echo $line | cut -f2 -d' ';
echo "to sink: $new_sink";
pacmd move-sink-input `echo $line | cut -f2 -d' '` $new_sink
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment