Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Choose pulseaudio sink via rofi/dmenu
#!/usr/bin/bash
# choose pulseaudio sink via rofi or dmenu
# changes default sink and moves all streams to that sink
sink=$(ponymix -t sink list|awk '/^sink/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}'|rofi -dmenu -p 'pulseaudio sink:' -location 6 -width 100|grep -Po '[0-9]+(?=:)') &&
# alternate version using dmenu:
# sink=$(ponymix -t sink list|awk '/^sink/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}'|dmenu -p 'pulseaudio sink:'|grep -Po '[0-9]+(?=:)') &&
ponymix set-default -d $sink &&
for input in $(ponymix list -t sink-input|grep -Po '[0-9]+(?=:)');do
echo "$input -> $sink"
ponymix -t sink-input -d $input move $sink
done
@Nervengift

This comment has been minimized.

Copy link
Owner Author

Nervengift commented Sep 22, 2015

needs ponymix and rofi (or dmenu) installed

@sentriz

This comment has been minimized.

Copy link

sentriz commented Jul 14, 2016

this is great, thank you

@zeltak

This comment has been minimized.

Copy link

zeltak commented Aug 19, 2016

Hi this is sweet. how does one choose a specific stream to send to a sink? ie if i have both mpd and youtube playing currently it moves both streams?

best

Z

@Nervengift

This comment has been minimized.

Copy link
Owner Author

Nervengift commented Mar 5, 2017

huh, I didn't see that last comment but for reference: this script moves all streams to the selected sink.

To send streams to different outputs, I prefer pavucontrol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.