aboutsummaryrefslogtreecommitdiff
path: root/cycle_pa_sinks
blob: a45ba158b5618a5790cb2a04bf465851e6215842 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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