This would take more hardware in the way of splitters and maybe some optical to analog convertor. I take it your TV does not support both at the same time so you get more hardware to make it happen.
The CHEAP EXIT is to connect a splitter to the headphone jack to run to the headphone and soundbar.
I would like to connect my parents' LG TV to their Sonos soundbar and their Sennheiser RS175 at the same time, but the tv only allows internal speakers + optical output or internal speakers + headphone output.
Ideally I would like an option that disregards the internal speakers, and allows the headphones and the optical output at the same time.
Does anyone know a workaround for this?
Thanks!

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic