feat: audio selector util finished

This commit is contained in:
2025-10-20 11:36:12 +02:00
parent d6854880de
commit a529837a0e
2 changed files with 13 additions and 2 deletions

View File

@@ -148,3 +148,5 @@ Print
flameshot gui flameshot gui
super + m super + m
st -e ncmpcpp st -e ncmpcpp
super + n
bash ~/.config/utils/selectors/audio_output.sh

View File

@@ -24,15 +24,24 @@ getFormalNameFromSink() {
*HDMI*) *HDMI*)
echo "External screen audio" echo "External screen audio"
;; ;;
*pci*)
echo "Core jack"
;;
*Logitech*)
echo "Logitech headset"
;;
*)
echo $1
;;
esac esac
} }
declare -A sink_map declare -A sink_map
declare menu_options 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) formal_name=$(getFormalNameFromSink $sink)
sink_map["$formal_name"]="$sink" sink_map["$formal_name"]="$sink"
if [[ ${#menu_options} -ne 0 ]]; then if [[ ${#menu_options} -ne 0 ]]; then