Skip to content

Commit

Permalink
Merge pull request vivien#421 from initialxy/master
Browse files Browse the repository at this point in the history
volume-pipewire fix forward sinks
  • Loading branch information
denisse-dev authored Oct 15, 2021
2 parents 01557be + e3ac741 commit e674a62
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions volume-pipewire/volume-pipewire
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,18 @@ CAPABILITY=$(amixer -D $MIXER get $SCONTROL | sed -n "s/ Capabilities:.*cvolume

function move_sinks_to_new_default {
DEFAULT_SINK=$1
pactl list sink-inputs | grep index: | grep -o '[0-9]\+' | while read SINK
pactl list sink-inputs | grep 'Sink Input #' | grep -o '[0-9]\+' | while read SINK
do
pactl move-sink-input $SINK $DEFAULT_SINK
done
}

function set_default_playback_device_next {
inc=${1:-1}
num_devices=$(pactl list sinks | grep -c index:)
sink_arr=($(pactl list sinks | grep index: | grep -o '[0-9]\+'))
default_sink_index=$(( $(pactl list sinks | grep index: | grep -no '*' | grep -o '^[0-9]\+') - 1 ))
num_devices=$(pactl list sinks | grep -c Name:)
sink_arr=($(pactl list sinks | grep Name: | sed -r 's/\s+Name: (.+)/\1/'))
default_sink=$(pactl get-default-sink)
default_sink_index=$(for i in "${!sink_arr[@]}"; do if [[ "$default_sink" = "${sink_arr[$i]}" ]]; then echo "$i"; fi done)
default_sink_index=$(( ($default_sink_index + $num_devices + $inc) % $num_devices ))
default_sink=${sink_arr[$default_sink_index]}
pactl set-default-sink $default_sink
Expand Down

0 comments on commit e674a62

Please sign in to comment.