From 968d85442683cf12a47e91e14ca74927b1055029 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Wed, 19 Jun 2019 21:33:01 +0200 Subject: [PATCH] Pulseaudio script to move stream to choosen sink --- move.pulseaudio.sink | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 move.pulseaudio.sink diff --git a/move.pulseaudio.sink b/move.pulseaudio.sink new file mode 100755 index 0000000..806f9d0 --- /dev/null +++ b/move.pulseaudio.sink @@ -0,0 +1,23 @@ +#!/bin/bash + +# `pacmd set-default-sink` doesn't want to work on my computer, +# so this small script will move all playback stream to the choosen sink. + +# Thanks to mreithub - https://unix.stackexchange.com/a/67398 + +if [ -z "$1" ]; then + echo "Usage: $0 " >&2 + echo "Valid sinks:" >&2 + pactl list short sinks >&2 + exit 1 +fi + +newSink="$1" + +pactl list short sink-inputs|while read stream; do + streamId=$(echo $stream|cut '-d ' -f1) + echo "moving stream $streamId" + pactl move-sink-input "$streamId" "$newSink" +done + +exit 0