diff options
Diffstat (limited to 'cycle_pa_sinks')
-rwxr-xr-x | cycle_pa_sinks | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cycle_pa_sinks b/cycle_pa_sinks new file mode 100755 index 0000000..a45ba15 --- /dev/null +++ b/cycle_pa_sinks @@ -0,0 +1,14 @@ +#!/bin/bash +# +# Cycle between the current PulseAudio sinks. +# Based on https://askubuntu.com/a/740002 +# +# Usage: ./cycle_pa_sinks +################################################################################ + +new_sink=$(pacmd list-sinks | grep -E "index|device.product.name" | tee /dev/stdout | grep -m1 -A3 "* index" | tail -2) +new_sink_idx=$(echo "$new_sink" | head -n1 | cut -c12-) +new_sink_name=$(echo "$new_sink" | tail -n1 | cut -f2 -d'"') + +echo "Setting default sink to: #$new_sink_idx ($new_sink_name)"; +pacmd set-default-sink $new_sink_idx |