commit 6fbb6273368b7a7d5b04d3d34f417db36dda3b37 Author: Joren Date: Mon Sep 23 14:44:38 2024 +0200 first commit diff --git a/VolumeMenu/volume b/VolumeMenu/volume new file mode 100755 index 0000000..1d3763a --- /dev/null +++ b/VolumeMenu/volume @@ -0,0 +1,32 @@ +#!/bin/bash + +SINKS=$(pactl list short sinks | awk '{print $2}') + +declare -A sink_map + +options="" +first=true +while read -r sink; do + device=$(echo "$sink") + device_name=$(pactl list sinks | grep -A 20 "$device" | grep "Description:" | awk -F: '{print $2}' | xargs) + + if [ "$first" = true ]; then + options+="$device_name" + first=false + else + options+="\n$device_name" + fi + sink_map["$device_name"]="$device" +done <<< "$SINKS" + +CHOSEN=$(echo -e "$options" | dmenu -l 10 -i -p "Select Audio Output") + +if [ -n "$CHOSEN" ]; then + CHOSEN_SINK=${sink_map["$CHOSEN"]} + pactl set-default-sink "$CHOSEN_SINK" + + for stream in $(pactl list short sink-inputs | awk '{print $1}'); do + pactl move-sink-input "$stream" "$CHOSEN_SINK" + done +fi +