Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pevers/nosleep
Cross-platform library to block the power save function in the OS
https://github.com/pevers/nosleep
caffeine nosleep powersave powersaving prevent-lock prevent-screen-lock
Last synced: about 2 months ago
JSON representation
Cross-platform library to block the power save function in the OS
- Host: GitHub
- URL: https://github.com/pevers/nosleep
- Owner: pevers
- Created: 2022-04-19T18:44:40.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-17T17:42:54.000Z (9 months ago)
- Last Synced: 2024-10-12T02:14:01.131Z (2 months ago)
- Topics: caffeine, nosleep, powersave, powersaving, prevent-lock, prevent-screen-lock
- Language: Rust
- Homepage:
- Size: 43.9 KB
- Stars: 9
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nosleep
[![Continuous Integration (macOS)](https://github.com/pevers/nosleep/actions/workflows/mac.yml/badge.svg)](https://github.com/pevers/nosleep/actions/workflows/mac.yml) [![Continuous Integration (Linux)](https://github.com/pevers/nosleep/actions/workflows/linux.yaml/badge.svg)](https://github.com/pevers/nosleep/actions/workflows/linux.yaml) [![Continuous Integration (Windows)](https://github.com/pevers/nosleep/actions/workflows/windows.yaml/badge.svg)](https://github.com/pevers/nosleep/actions/workflows/windows.yaml) [![license](https://img.shields.io/crates/l/nosleep?style=flat-square)](https://crates.io/crates/nosleep/) [![version](https://img.shields.io/crates/v/nosleep?style=flat-square)](https://crates.io/crates/nosleep/) ![Crates.io](https://img.shields.io/crates/d/nosleep?style=flat-square)
Cross-platform library to block the power save function in the OS.
```rust
use nosleep::{NoSleep, NoSleepTrait};
let mut nosleep = NoSleep::new().unwrap();
nosleep
.prevent_display_sleep() // or prevent_system_sleep()
.unwrap();
std::thread::sleep(std::time::Duration::from_millis(180_000));
nosleep.stop().unwrap(); // Not strictly needed
```## Supported Platforms
| Platform | Status | Tested |
|----------|--------|--------|
| Linux | ✔️ | ✔️ |
| macOS | ✔️ | ✔️ |
| Windows | ✔️ | ✔️ |
| iOS | ❌ | ❌ |
| Android | ❌ | ❌ |