[orca-list] change PulseAudio Sound sink



Hi List,

i have an other code mabye usefull for some people.
my girlfrind had a few minutes ago the problem that she puts the HDMI cable out of the Laptop But PulseAudio seems it not to reconize. Result is no speak anymore. thats not acceptable if no braile device is plugged in. she try to plug the HDMI cable in again -> still no sound. Here something wents wrong. bevor this will happen again i found a little script for toggeling through all soundcards and improved it for my case. Never ever no speak :)

put it in a executable textfile and give the script a shortcut via gnome-controll-center or whatever.
works perfect for me and my girly.
here the script:
#!/bin/bash

sinks=(`pacmd list-sinks | sed -n -e 's/\**[[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p'`)
sinks_count=${#sinks[ ]}
active_sink_index=`pacmd list-sinks | sed -n -e 's/\*[[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p'`
newSink=${sinks[0]}
ord=0

while [ $ord -lt $sinks_count ];
do
    echo ${sinks[$ord]}
    if [ ${sinks[$ord]} -gt $active_sink_index ] ; then
        newSink=${sinks[$ord]}
        break
    fi
    let ord++
done

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
pacmd set-default-sink "$newSink"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]