pevers / tauri-plugin-nosleep

Tauri plugin to block the power save functionality in the OS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tauri-plugin-nosleep

Test

Tauri plugin to block the power save functionality in the OS

fn main() {
  tauri::Builder::default()
    .plugin(tauri_plugin_nosleep::init())
    .run(tauri::generate_context!())
    .expect("failed to run app");
}

Add the NPM package.

npm install tauri-plugin-nosleep-api
# or
yarn add tauri-plugin-nosleep-api

Use this within TS/JS.

import { block, NoSleepType, unblock } from 'tauri-plugin-nosleep-api'
block(NoSleepType.PreventUserIdleDisplaySleep);
// To unblock whenever you are done
unblock();

About

Tauri plugin to block the power save functionality in the OS

License:MIT License


Languages

Language:Rust 55.9%Language:TypeScript 25.8%Language:JavaScript 18.3%