You cannot disable the speakers with the S2316H controls. You would have to do this via the operating system Audio Playback. But lowering the speaker volume to 0 in the S2316H OSD (On Screen Display) -Audio should not effect the volume of the headphones in the Audio Line Out port. Test that for us.
Yes, that's works, but I meant how to make it happen automatically. As well as the rear outputs of the motherboard are disabled when connected to the outputs on the front panel.