Skip to content

Instantly share code, notes, and snippets.

@gianpaj
Created March 8, 2023 17:23
Show Gist options
  • Save gianpaj/6334e6a4cd1f9fe48b58c1e7b8ccd5a2 to your computer and use it in GitHub Desktop.
Save gianpaj/6334e6a4cd1f9fe48b58c1e7b8ccd5a2 to your computer and use it in GitHub Desktop.
This script toggles between the two audio devices on macOs using `switchaudio-osx`
#/bin/bash
TOGGLE_TO="Scarlett Solo USB"
CURRENT=$(SwitchAudioSource -c -f cli | sed -e 's/,.*//')
echo "Current audio device: \"$CURRENT\""
if [ "$CURRENT" = "External Headphones" ]; then
SwitchAudioSource -s "Scarlett Solo USB"
else
SwitchAudioSource -s "External Headphones"
fi
CURRENT=$(SwitchAudioSource -c -f cli | sed -e 's/,.*//')
echo "✅ Switched to: \"$CURRENT\" 🎉"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment