When

  1. The audio output device changes.

If

AND
  1. The audio output device from Audio Output Device Changed contains AirPods

Set Volume and Open Spotify

  1. Set the output volume to 20%
  2. Launch Spotify

If

AND
  1. The audio output device from Audio Output Device Changed contains Speakers

Do

  1. Set the output volume to 30%

Apply volume when the output device changes

This Rule is useful when headphones and speakers need different starting volume levels. It reacts to the audio output device selected by macOS, checks its name, and applies the corresponding branch rather than requiring you to adjust volume manually after every switch.

When: The audio output device changes. If: Its name contains AirPods, set volume to 20 and launch Spotify. In the separate Speakers branch, set volume to 30. Devices matching neither name receive no Action from the sample.

Configure and try it

  1. Import with Open this Rule in Rulr and review the exact names macOS reports for your audio outputs.
  2. Replace the name fragments in the Conditions with values that identify your devices. Choose distinct matches if each device should use only one branch.
  3. Set comfortable volume levels and review the Spotify launch Action. Select an installed music app, remove that step, or keep Spotify if it belongs in your routine.
  4. Enable the Rule and switch outputs using macOS Sound controls. Check the resulting volume and whether the intended app launches. Try an unmatched device too.

To change the device itself rather than only its volume, compare Switch Audio Output. The Variables library lists audio state values, and the Mac automation guide shows how device events and Conditions fit into a Rule.

Requirements and limits

The sample’s components are available without Pro and declare no special permission. The music app must be installed if you retain its launch Action, and the output device must support the requested volume change.

The Rule responds to an output-device change, not merely a Bluetooth connection. It does not connect headphones, start playback, or maintain a continuous volume limit. For choosing an output with a manual shortcut first, use Switch Audio Output.