first commit

This commit is contained in:
Joren 2024-09-23 14:44:38 +02:00
commit 6fbb627336
Signed by: Joren
GPG Key ID: 280E33DFBC0F1B55

32
VolumeMenu/volume Executable file
View File

@ -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