Couple suggestions that may sound crazy.
For personal defense always have a can of wasp spray handy. In the car, at work, at home etc. It works up to 20ft and, if you hit them in the face, will slow them enough for you to run or arm yourself with something.
For doors and windows:
Buy a bunch of extension cords. Leave the prong end alone and cut off the other end. Strip back the wires and tie one wire to the grate (window or door) and another to the frame for that grate. If you catch someone breaking in then plug it into the outlet. Not sure about where you live but you may have 220v outlets which will really light up someone’s life!