The switch above does not affect how the TV reacts when you plug a headphone into the headphone jack of tjhe TV. You cannot connect heaphones directly to this switch.
If your TV has an optical audio output you don't need this switch you just need a headphone transmitter( for wireless or bluetooth headphones) or amplifier with an optical input (for wired headphones). Using the optical out does not affect whether the TV speakers are on or off and the volume of the TV speakers is independent of the headphone volume..
If your TV only has headphone out then you will need to connect the same transmitter or headphone amplifier to the output of the HDMI switcher. This will also give you result you want.