From a529837a0e3e5f91036f0261527518e0d38490a1 Mon Sep 17 00:00:00 2001 From: Daniel Heras Quesada Date: Mon, 20 Oct 2025 11:36:12 +0200 Subject: [PATCH] feat: audio selector util finished --- sxhkd/sxhkdrc | 2 ++ utils/selectors/audio_output.sh | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sxhkd/sxhkdrc b/sxhkd/sxhkdrc index 19f0bd7..56c55c0 100644 --- a/sxhkd/sxhkdrc +++ b/sxhkd/sxhkdrc @@ -148,3 +148,5 @@ Print flameshot gui super + m st -e ncmpcpp +super + n + bash ~/.config/utils/selectors/audio_output.sh diff --git a/utils/selectors/audio_output.sh b/utils/selectors/audio_output.sh index b92a23f..4bea01e 100644 --- a/utils/selectors/audio_output.sh +++ b/utils/selectors/audio_output.sh @@ -24,15 +24,24 @@ getFormalNameFromSink() { *HDMI*) echo "External screen audio" ;; + *pci*) + echo "Core jack" + ;; + *Logitech*) + echo "Logitech headset" + ;; + *) + echo $1 + ;; esac } declare -A sink_map declare menu_options -sink_list=$(pactl list sinks | grep -e "Name" | awk -F: '{print $2}' | xargs) +readarray -t sink_list < <(pactl list sinks | grep -e "Name" | awk -F: '{print $2}') -for sink in $sink_list; do +for sink in "${sink_list[@]}"; do formal_name=$(getFormalNameFromSink $sink) sink_map["$formal_name"]="$sink" if [[ ${#menu_options} -ne 0 ]]; then