Skip to content

Instantly share code, notes, and snippets.

@CIAvash
Created June 11, 2021 12:17
Show Gist options
  • Save CIAvash/c78612b7015180c9ed071381e0a2318d to your computer and use it in GitHub Desktop.
Save CIAvash/c78612b7015180c9ed071381e0a2318d to your computer and use it in GitHub Desktop.
Select/Switch Pulse/Pipewire audio sink/device/node with `rofi` and `pactl`
#!/usr/bin/env bash
all_sinks=$(pactl list short sinks | cut -f 2)
default_sink=$(pactl info | grep 'Default Sink' | cut -d : -f 2)
active_sink=$(echo "$all_sinks" | grep -n $default_sink | cut -d : -f 1)
selected_sink=$(echo "$all_sinks" | rofi -dmenu -i -a $(($active_sink - 1)) -p 'Select a device: ')
pactl set-default-sink $selected_sink
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment