Function screenlocker::lock_screen

source ·
pub fn lock_screen() -> Result<(), Error>
Expand description

Locks the computer screen by hiding the current desktop, and requiring the user to re-enter their password before continuing.

Errors

If lock_screen() encounters any errors while trying to lock the screen, an error variant will be returned. Macs do report errors, and while possible on Windows it is exceptionally unlikely. Screen locking on Linux could return an error if none of the hard coded screen locking programs exist on the system.

Please open an issue or create a pull request if the hardcoded Linux list is missing a screen locking program for your distro.