How to play sound only when earphones are plugged in
I'm looking for a way to make it so that my computer only plays the sound when the earphones are plugged in. Regularly, if there's sound available and the volume is not muted, the sound will play without the earphones, and then when they get plugged in, the sound stops being played through the speakers, and only plays through the earphones themselves. Fine. However, I'd like to avoid that, say, I accidentally un-plug the earphones while listening to some music, and it echoes everywhere in the house in the middle of the night before I can mute the sound/re-plug-in the earphones.
So, is there a way to keep the main speakers of the computer indipendent from the earphones, so I can mute the ones, and turn on the others?