KeyRoutines
TriggerFreetrigger.audio.deviceChanged

Run a routine when a headset connects or disconnects

Audio device changed starts a routine when a headset or other audio device connects, disconnects, or becomes the Windows default. It is the starting point for setups that switch sound the moment you plug in or pair your headphones.

How it works

  • Choose the event: connects, disconnects, or becomes the default, and pick a device or leave it empty for any device.
  • With no device picked, you can limit it to playback devices, recording devices, or both.
  • Windows reports one plug as several messages, and Bluetooth headsets drop out briefly when they switch between music and call modes, so the trigger waits for things to settle and fires once per real change.
  • The settle time is adjustable; the default is two seconds.
  • The routine receives the device's name, so later steps can use it.

Routines that use it

Headset connected

When the headset connects, switch to it with Set default audio device and set Discord's microphone with Discord: input device.

Unplug pauses the music

When the headphones disconnect, pause playback with Media control so music doesn't blast from the speakers.

Mic check reminder

When a USB microphone connects, Set volume puts it at your usual recording level and Show banner confirms it.

Settings

SettingWhat it does
OnFire when the device connects, disconnects, or becomes the default.
DeviceThe headset, speakers or microphone. Empty: any device.
Any ofadvancedWith no device picked: playback devices, recording devices, or both.
SettleadvancedHow long a change must hold before it counts. Bluetooth headsets drop out for a moment when they switch modes.

Good to know

  • A change that lasts less than the settle time is ignored on purpose.

Questions

How do I automatically switch audio when headphones are plugged in?
Create a routine with Audio device changed set to connects for your headphones, and add Set default audio device for the same headphones. Windows' sound moves to them each time they connect.
Why didn't it fire when my Bluetooth headset flickered?
Short drop-outs shorter than the settle time are treated as no change, which stops a headset that switches modes from firing your routine twice. Lower the settle time if you want every change.

Pairs well with

Build this routine in KeyRoutines

Free from the Microsoft Store for Windows 11 and 10. Pro is a one-time upgrade.