Skip to content

Instantly share code, notes, and snippets.

@beiker
Last active September 12, 2023 03:04
Show Gist options
  • Select an option

  • Save beiker/0dfe05b67e719ebd2a39494271c60c54 to your computer and use it in GitHub Desktop.

Select an option

Save beiker/0dfe05b67e719ebd2a39494271c60c54 to your computer and use it in GitHub Desktop.
Script Kit Sound Output
// Name: Sound Output
// Description: Select a device for sound output
// https://apple.stackexchange.com/questions/213011/any-way-to-change-sound-output-device-via-applescript-or-shell
import '@johnlindquist/kit'
const {stdout} = await exec('SwitchAudioSource -a -t output')
const outputSelected = await arg(
'Select a device for sound output',
stdout.split('\n').map(device => ({name: device, value: device})),
)
await exec(`SwitchAudioSource -t output -s '${outputSelected}'`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment