Skip to content

Instantly share code, notes, and snippets.

@new-penguin
Created January 20, 2024 13:12
Show Gist options
  • Save new-penguin/1aa80316b3d104f64635bc3b4cdbab2e to your computer and use it in GitHub Desktop.
Save new-penguin/1aa80316b3d104f64635bc3b4cdbab2e to your computer and use it in GitHub Desktop.
Quickly switch audio in pipewire. Works great when set to a global hotkey
#!/bin/bash
# Define sinks
NORMALIZED='Normalized'
STANDARD='alsa_output.pci-0000_0e_00.4.iec958-stereo'
# Get first line of running audio sink and choose other
if [ $(pactl list short sinks | grep -m 1 RUNNING | awk {'print $2'}) = $STANDARD ]; then
DEVICE=$NORMALIZED
else
DEVICE=$STANDARD
fi
# Set default device
pactl set-default-sink $DEVICE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment