#!/bin/sh
# switches the default sink to the next device

get_all_sinks ()
{
  ALL_SINKS="$( pacmd "list-sinks" | grep "index:\|name:\|device.description" | \
    sed 's/*/Default: /g' | \
    sed 's/\(Default:\)* index:[ ]*\([0-9]*\).*/\1 #\2/' | \
    sed 's/.*<alsa_output\.\(.*\)>/\1/' | \
    sed 's/.*device.description.*=.*\(".*"\)/\1/' )"
}

print_all_sinks ()
{
  echo "$ALL_SINKS" | while read index && read name && read desc; do
    echo -n "$index - $name - $desc"
    echo
  done
}

get_all_sinks

print_all_sinks
