GithubHelp home page GithubHelp logo

pevers / nosleep Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 2.0 36 KB

Cross-platform library to block the power save function in the OS

Rust 94.13% Objective-C 5.87%
nosleep caffeine powersaving powersave prevent-lock prevent-screen-lock

nosleep's Introduction

nosleep

Continuous Integration (macOS) Continuous Integration (Linux) Continuous Integration (Windows) license version Crates.io

Cross-platform library to block the power save function in the OS.

use nosleep::{NoSleep, NoSleepType};
let mut nosleep = NoSleep::new().unwrap();
nosleep
    .start(NoSleepType::PreventUserIdleDisplaySleep)
    .unwrap();
std::thread::sleep(std::time::Duration::from_millis(180_000));
nosleep.stop().unwrap(); // Not strictly needed

nosleep's People

Contributors

pevers avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

nosleep's Issues

DBus-Error UnknownInterface on Manjaro Linux

Running cargo test fails on my machine:

OS: Manjaro Linux 22.0.0 x86_64
Kernel: 6.0.2-2-MANJARO
Desktop: KDE Plasma 5.25.5

I get the following output:

---- tests::test_block_platform_agnostic stdout ----
thread 'tests::test_block_platform_agnostic' panicked at 'called `Result::unwrap()` on an `Err` value: 
DBus { 
    source: D-Bus error: No such interface 'org.freedesktop.PowerManagment.Inhibit' at object path 
        '/org/freedesktop/PowerManagement/Inhibit' (org.freedesktop.DBus.Error.UnknownInterface), 
    backtrace: Backtrace(()) 
}', src/lib.rs:41:24

[all] prevent dangling resources

Description

Make sure that multiple calls to start will not acquire multiple blocks but will clear the old blocks and handles to prevent any leaks.

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.