#tauri-plugin #ios #android #screen #tauri #plugin

sys tauri-plugin-keep-screen-on

A Tauri plugin that prevents screen timeout on Android and iOS

5 releases

0.1.4 Aug 30, 2024
0.1.3 Aug 8, 2024
0.1.2 Aug 8, 2024
0.1.1 Aug 7, 2024
0.1.0 Aug 3, 2024

#21 in #tauri

Download history 115/week @ 2024-07-30 377/week @ 2024-08-06 78/week @ 2024-08-13 134/week @ 2024-08-27 2/week @ 2024-09-03 6/week @ 2024-09-10 4/week @ 2024-09-17 6/week @ 2024-09-24 25/week @ 2024-10-01

327 downloads per month

MIT/Apache

13KB
295 lines

Tauri Plugin keep-screen-on

Provides commands to disable automatic screen dimming in Android and iOS.

Install

If you are installing from npm and crate.io package registry, make sure the versions for both packages are the same, otherwise, the API may not match.

Install the Core plugin by adding the following to your Cargo.toml file:

src-tauri/Cargo.toml

[dependencies]
tauri-plugin-keep-screen-on = "0.1.2"

You can install the JavaScript Guest bindings using your preferred JavaScript package manager:

pnpm add tauri-plugin-keep-screen-on-api
# or
npm add tauri-plugin-keep-screen-on-api
# or
yarn add tauri-plugin-keep-screen-on-api

Usage

First you need to register the core plugin with Tauri:

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_keep_screen_on::init())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

Afterwards all the plugin's APIs are available through the JavaScript guest bindings:

import { keepScreenOn } from "tauri-plugin-keep-screen-on-api";

keepScreenOn(true);

Or in Leptos:

#[derive(Serialize)]
struct KeepScreenOnArgs {
    enable: bool,
}


invoke(
        "plugin:keep-screen-on|keep_screen_on",
        to_value(&KeepScreenOnArgs { enable: true })
        .expect("Failed to serialize KeepScreenOnArgs"),
      )
.await
.unwrap();


License

Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.

MIT or MIT/Apache 2.0 where applicable.

Dependencies

~18–59MB
~891K SLoC