alfred-workflows: [Bug]: switch-audio does not on macOS 13 Ventura

Describe the bug

switch-audio workflow is no longer working on macOS 13 Ventura.

Behavior: The sound and voice commands do not return the devices list.

MacOS Version

macOS 13 Ventura

Alfred Version

Alfred 5.0.5

Workflow Name

Switch Audio

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (6 by maintainers)

Most upvoted comments

any updates? this was one of my most used workflows up until Ventura.

In development.

I gave up on using AppleScript and decided to do secondary development based on switchaudio-osx.

list airplay device is ok. but switch to airplay not work. I need to find method to do it.

image

AppleScript documentation was so poor that I had to consider learning Swift to solve it.

@TobiasMende

I will update my home mac to Ventura and have a try.

any updates? this was one of my most used workflows up until Ventura.

I have adapted it locally to work with Mac OS Ventura. I am using switchaudio-osx and jq in order to select and switch the devices without relying on AppleScript and the System Settings.

Therefore, my solution is not an easy drop-in, but in case you are interested, my main.sh looks like:

#!/bin/zsh
type=$1
current=$(SwitchAudioSource -c -t $type -f json)
current_id=$(echo $current | jq -r '.id')
current_extended=$(echo $current | jq -rc --arg TYPE "$type" '{title: .name, uid: .name, autocomplete: .name, arg: .id, icon: {path: ("./icons/"+ $TYPE + "_selected.png")}}')
all_without_current=$(SwitchAudioSource -a -t $type -f json | jq -rc --arg CURRENT "$current_id" 'select(.id != $CURRENT) | {title: .name, uid: .name, autocomplete: .name, arg: .id}')
echo "$all_without_current\n$current_extended" | jq -r --slurp 'sort_by(.title) | {items: .}'

can be called via ZSH ./main.sh output (or input)

Preconditions can be installed via

brew install switchaudio-osx jq

The actual command for switching then is a ZSH script as well

SwitchAudioSource -i $1 > /dev/null

SwitchAudioSource -c

If that is a path you consider going with the plugin, I am happy to provide a PR.