Files
dotfiles/scripts/files/rofi-media.sh
T
2026-03-04 11:15:35 +00:00

17 lines
558 B
Bash
Executable File

#!/bin/bash
# Get the list of sinks and format for Rofi (index and name)
sinks=$(pactl list sinks short | awk '{print $2}')
# Use Rofi to select a sink (case-insensitive search)
selected_sink_name=$(echo "$sinks" | rofi -i -dmenu -p "Select audio output:")
# If a sink was selected
if [ -n "$selected_sink_name" ]; then
# Get the index of the selected sink
selected_sink_index=$(pactl list sinks short | grep -F "$selected_sink_name" | awk '{print $1}' | head -n 1)
# Set the default sink
pactl set-default-sink "$selected_sink_index"
fi