(scripts) fixed audio sink switcher for artix installation
This commit is contained in:
@@ -5,12 +5,11 @@ select_audio_sink() {
|
||||
|
||||
IFS=$(echo -en "\n\b")
|
||||
devices=($(echo "${sinks}" | grep -ioP "(?<=name: ).*$"))
|
||||
ids=($(echo "${sinks}" | grep -ioP "(?<=object.serial = ).*$"))
|
||||
names=($(echo "${sinks}" | grep -ioP "(?<=device\.description = ).*$"))
|
||||
names=($(echo "${sinks}" | grep -ioP "(?<=description: ).*$"))
|
||||
unset IFS
|
||||
|
||||
if [[ "${#ids[@]}" != "${#names[@]}" ]] || [[ "${#ids[@]}" != "${#devices[@]}" ]]; then
|
||||
echo "ERROR: #ids (${#ids[@]}) != #names (${#names[@]})"
|
||||
if [[ "${#devices[@]}" != "${#names[@]}" ]]; then
|
||||
echo "ERROR: #devices (${#devices[@]}) != #names (${#names[@]})"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -25,10 +24,10 @@ select_audio_sink() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ((${#ids[@]} > 16)); then
|
||||
if ((${#devices[@]} > 16)); then
|
||||
lines=16
|
||||
else
|
||||
lines=${#ids[@]}
|
||||
lines=${#devices[@]}
|
||||
fi
|
||||
|
||||
if $(which rofi &>/dev/null); then
|
||||
@@ -57,7 +56,7 @@ select_audio_sink() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
pactl set-default-sink ${ids[$number]//\"/}
|
||||
pactl set-default-sink ${devices[$number]//\"/}
|
||||
}
|
||||
|
||||
select_audio_sink
|
||||
|
||||
Reference in New Issue
Block a user