A friend related this story:
Taking a nap under a open, but screened, window he became aware of someone lifting up the screen and climbing in over top of him. He waited until the guy was committed and unable to run. Reaching under his pillow he took out his .38 revolver. He pushed this literally up the guys nose and had him bent backward. He cocked the gun for effect.

And then told him that he was going to blow his brains out if he didn't do something. Assent was immediate. The instructions were to go home and tell all of his homies that there was a scary, deranged guy who has a gun living in this apartment complex. That there would be no second chances for anyone ever again. The next guy that he caught would be shot and buried deep in the woods. He then let the guy go.

---------

The small apartment complex in the story had previously been robbed three or four times a year. It went five years without a break-in. Evidently the message got out.

I once had a guy try my door and, finding it unlocked, he snuck into the dark apartment from the lit porch. At the time I was buck naked and listening to a concert on the radio using headphones. I was watching him approach my door. I picked up a large knife and was standing in front of him, ghost-white, naked and armed, when his eyes adjusted. The look on his face was worth it. He didn't so much run as evaporate.

He was a block away by the time the screen door slammed. Evidently quiet, naked, music loving guys with large knives aren't his idea of good company. Go figure. Kind of hurts my feelings.

As in the previously cited case the frequency of robberies went down for a considerable amount of time after this.

While there are exceptions, like home invasions that are usually triggered by the advertised presence of drugs or large sums of money, the vast majority of intruders wish to avoid human interaction. They are generally lazy, simple-minded bottom feeders who are easily discouraged by simple having well secured doors and windows. Almost all flee if confronted.

That doesn't mean you might not do well to have sterner measures handy but it is important to keep the shape and size of the relative risk in mind and to not treat every situation like your repelling a hoard of zombie bikers bent on eating your brains.