Feel safe giving permission to your web cam. All data is processed locally. No video is ever streamed to a server.
You set the distance to your monitor and set the sensitivity for how much leaning is allowed. High sensitivity will alert you instantly when you lean.
Launch Slouchcam and leave it in a background tab. You will receive a notification anytime you slouch too close to the screen.
Check out my current experiment: Sun and shadow on Google maps