Audio output not automatically switching when headphones plugged in

Hey everyone, not sure if this is the right place for this - kind of a noobie

I frequently switch my hdmi output from my monitor to my tv so I can watch shows, and when I’m working on my computer I use wired headphones. I would like the output to be automatically switched to my headphones when they are plugged in and switched back to HDMI when they are unplugged. As of now I have to manually switch the output in sound settings. Here are screenshots of my output devices in pavucontrol
In “built in audio analog stereo” there is also a “Line out (unplugged)” .
I’m not sure what other information I could provide but if you need to know something to help just ask. Thank you in advance