Git Product home page Git Product logo

screenlocker's Introduction

screenlocker

CI build state Code license Crate version Maintenance state

Screenlocker is a cross platform command line tool that locks your desktop session until a password is entered. It is also a reusable library for developers who want to perform this action programmatically.

Installation

Use Rust's cargo tool to install screenlocker.

$ cargo install screenlocker
$ screenlocker     # if $PATH contains `~/.cargo/bin`

Please contact me or create a new issue if you would like to have downloadable installers for your platform rather than use cargo.

Usage

The latest API documentation is available from a link on screenlockers's crates.io page. All you need is the lock_screen function, as seen here in this example:

use screenlocker::lock_screen;

fn main() {
    lock_screen().unwrap_or_else(|err| {
      eprintln!("{}", err);
    });
}

Building

Make sure you install Rust on your computer before building.

$ git clone https://github.com/smacdo/screenlocker.git
$ cd screenlocker
$ cargo test
$ cargo run

Multi-platform support

On Mac and Windows this crate uses the platform's native SDK to implement screen locking. Linux does not have any such functionality, and instead relies on any number of programs to lock the screen. This crate hard codes the most common programs (xdg-screensaver, gnome-screensaver-command, etc) but it is possible that less mainstream window managers don't work. Please open an issue to flag this problem - or better - a pull request adding the missing program.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

screenlocker's People

Contributors

smacdo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.