Use Alfred to Toggle AirPlay on macOS
Install Alfred.
-
Import the Alfred alfred-airplay-selector workflow by double-clicking the workflow file after downloading it.
-
I wasn't able to figure out how to use 'description' in AppleScript, sadly, so please set 'appletv' to its proper index in your list.
Note 1: that the horizontal rule / separator seems to count as an item.
Note 2: if you have more than one Apple TV you'd like to toggle, you'll need to implement the description support.
In Alfred type the following:
To Enable Apple TV:
ap
To Disable Apple TV:
ap off
orap blah
Note: You can type anything as an argument, just not empty string to disable AirPlay.
Thank you, qorbani, AirControl, and n8henrie.