Notch Stud for Electrical Work Box
Usually doors and windows had two studs on each side ( cripple and King cripple ) if this is the case you should cut no more than half way into the King cripple.  From your picture  either the door is slid over to one side of the rough opening, has blocks nail to the King cripple, or you  have a stud next to the cripplebbecause of layout. I say this because of how much space you have between the switch and the trim. If you could determine if is just blocks cut away as much as you need. If it is a stud or the door is slid over I would check into some Slim-line boxes. These boxes are not as deep as regular boxes this way you can just notch a smaller depth letting you notch a wider width and keep the strength.