Maybe, but the problem with that is I know of no headphones where the -ve wires for L and R are not commoned. You could re-wire some headphones so that L and R go to separate mono plugs, with two mono switched sockets, but also note that the volume levels driving speakers will probably not be appropriate for driving headphones, so some kind of attenuation will be required (unless you want to keep turning the volume up and down).
There exist jack sockets with multi-way switching arrangements, but they are hard to get. The easiest choices are: (1) a manual push button / toggle switch to cut off the speakers; (2) a relay to do the job of the switch, engaged by a contact in the socket. Let me explain the manual switch circuit - it should be obvious how to automate it with a relay (for which you would need a "stereo with on off switch" socket, using the on/off contact to energise the relay).
The resistors I've shown with question marks are a case of trial an error, to get acceptable volume levels in the headphones at normal volume settings for the speakers. The capacitors float the DC load of the headphones commoned to 0V (which the bridged speaker drivers are not designed for).
Military and Automotive Electronics Design Engineer (retired)
For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!