From d362f0353409757088ff6a99eebc69062d8eaff3 Mon Sep 17 00:00:00 2001 From: zegonix Date: Mon, 20 Apr 2026 09:27:48 +0200 Subject: [PATCH] (scripts) fixed audio sink switcher for artix installation --- scripts/audio-sink-switcher.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/audio-sink-switcher.sh b/scripts/audio-sink-switcher.sh index bd2c000..8ac6203 100755 --- a/scripts/audio-sink-switcher.sh +++ b/scripts/audio-sink-switcher.sh @@ -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