Quantcast
Channel: How do I detect if headphones are connected (via the jack) in bash? - Ask Different
Viewing all articles
Browse latest Browse all 2

How do I detect if headphones are connected (via the jack) in bash?

$
0
0

I have a script, and I want it to behave differently if headphones are connected. How can I get this information?

I tried using SwitchAudioSource, but its output is the same, whether or not the headphones are connected:

~/tmp❯ SwitchAudioSource -cBuilt-in Output~/tmp❯ SwitchAudioSource -aBuilt-in Microphone (input)Background Music (input)Background Music (UI Sounds) (input)Built-in Output (output)Background Music (output)Background Music (UI Sounds) (output)

Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>