my dotfiles for arch
at main 558 B view raw
1#!/bin/bash 2 3# Get the list of sinks and format for Rofi (index and name) 4sinks=$(pactl list sinks short | awk '{print $2}') 5 6# Use Rofi to select a sink (case-insensitive search) 7selected_sink_name=$(echo "$sinks" | rofi -i -dmenu -p "Select audio output:") 8 9# If a sink was selected 10if [ -n "$selected_sink_name" ]; then 11 # Get the index of the selected sink 12 selected_sink_index=$(pactl list sinks short | grep -F "$selected_sink_name" | awk '{print $1}' | head -n 1) 13 14 # Set the default sink 15 pactl set-default-sink "$selected_sink_index" 16fi