A Mac-only script using the switchaudio-osx tool to quickly change audio output devices

Open switch-audio in Script Kit

## Switch audio output device
// Name: Switch Audio
// Description: Switch audio output device (Mac only)
// Author: Nate Drake
// Install SwitchAudioSource with `brew install switchaudio-osx`
import "@johnlindquist/kit"
const SwitchAudioSourcePath = '/opt/homebrew/bin/SwitchAudioSource'
const sasExists = await pathExists(SwitchAudioSourcePath)
if (sasExists) {
const currentOutput = await $`${SwitchAudioSourcePath} -c`
const items = await $`${SwitchAudioSourcePath} -a -t output`
const choices = items.stdout.trim().split(/\r?\n/).filter(o => o !== currentOutput.stdout.trim())
let output = await arg(
placeholder: 'Pick ouput device'
await $`${SwitchAudioSourcePath} -s ${output} -t output`
} else {
await div(md(`ERROR: Please install SwitchAudioSource`))