Having both speakers and headphones plugged in and switching in software on-the-fly.
Just run this bash.
This is script doing these work [https://askubuntu.com/a/1005980/993527]
Run :
git clone https://github.com/biplobsd/Fixing-front-panel-audio.git
cd Fixing-front-panel-audio
chmod +x Fixing-front-panel-audio.sh
./Fixing-front-panel-audio.sh
I've been test this script on [Ubuntu/Zorin OS]