Last active
September 12, 2023 03:04
-
-
Save beiker/0dfe05b67e719ebd2a39494271c60c54 to your computer and use it in GitHub Desktop.
Script Kit Sound Output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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