Skip to content

canova/lock-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lock-rs

Locks your system. Shows the login screen the next time you use the computer.

Binary usage

You can use this as a binary with compiling and adding the binary to your path. Usage is very simple:

$ lock

Library usage

You can also use this as a library in your rust program. Firstly, add this dependency to your Cargo.toml:

[dependencies]
lock = "0.1"

And use it like this. Again, usage is very simple:

extern crate lock;

use lock::{FailureReason, lock};

fn main() {
    let result = lock();

    match result {
        Err(FailureReason::CannotExecute) => {
            // Failed to execute command, do something.
        },
        Err(FailureReason::LinuxCommandNotFound) => {
            // There is no xdg-screensaver, gnome-screensaver or dm-tool for linux,
            // do something else.
        }
        Ok(()) => (),
    }
}

About

Lock your system. Supports macOS, Linux, and Windows.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages