It is super easy to automatically lock a MacBook after a few minutes of inactivity, but this requires enabling a screensaver.
https://www.google.com/search?q=auto+lock+macbook
However, this method is frustrating, because launching any screensaver appears to take the focus away from the currently active application.
This means if I'm running Chrome, for example, and the screensaver is triggered, I will have to type in my password, and then click anywhere on the screen before I can interact with the Chrome app. If I wanted to open a new tab (CMD+T), pressing these keys on the keyboard does nothing until after I've clicked to regain focus.
Say I have a full-screen terminal window open. After logging back into in, the terminal will not accept any keyboard input until I click somewhere on the screen with the mouse.
Really annoying.
How to get around this?
Automatically locking the computer WITHOUT spawning a screensaver seems like it would work, because locking the computer manually doesn't produce the issue. How to auto-lock without a screensaver?