Aeronautical-Studios / tauri-plugin-nosleep-fork

Tauri plugin to block the power save functionality in the OS

Home Page:https://www.npmjs.com/package/tauri-plugin-nosleep-api-fork

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tauri-plugin-nosleep-fork

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-fork
# or
yarn add tauri-plugin-nosleep-api-fork

Then add these permissions to your App capabilities.

{"permissions": [
    "nosleep:allow-unblock",
    "nosleep:allow-block",
  ]
}

Use this within TS/JS.

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

About

Tauri plugin to block the power save functionality in the OS

https://www.npmjs.com/package/tauri-plugin-nosleep-api-fork

License:MIT License


Languages

Language:Rust 57.3%Language:TypeScript 25.0%Language:JavaScript 17.7%