#!/bin/sh # This script is just used to get the current PA sink, # and to change to the 'next' sink. Using only 'pactl'. get_default_sink (){ echo "$(pactl info | grep Sink | awk '{print $3}')" } get_default_sink_nickname (){ sink_list="$(pactl list sinks\ | grep -e Name -e alsa.card_name\ | sed -e 's/^\ *//' -e 's/\ *$//')" default_sink="$(get_default_sink)" found_default_sink="0" while IFS= read line; do # Trim line depending on content. if [ "$(echo $line | cut -d' ' -f1)" = "Name:" ]; then line="$(echo $line | cut -d' ' -f2)" else line="$(echo $line | cut -d' ' -f3- | sed 's/\"//g')" fi # If fond default_sink, get and set the nickname, then exit. if [ "$found_default_sink" = "1" ]; then echo "$line" break; fi # If current line is the default sink, set a flag. if [ "$default_sink" = "$line" ]; then found_default_sink="1" fi done <