tauri-plugin-screen-wake-lock-api
v0.1.0
Published
A Tauri plugin to keep the screen awake while enabled (desktop only).
Downloads
109
Maintainers
Readme
Tauri Plugin screen-wake-lock
Keep the display awake while enabled (desktop only).
Usage
Register the plugin:
tauri::Builder::default()
.plugin(tauri_plugin_screen_wake_lock::init())
.run(tauri::generate_context!())?;Use from JavaScript:
import { isSupported, setEnabled } from 'tauri-plugin-screen-wake-lock-api'
if (await isSupported()) {
await setEnabled(true, { reason: 'Playing video' })
}Disable when no longer needed:
import { disable } from 'tauri-plugin-screen-wake-lock-api'
await disable()Linux-specific options (optional):
await setEnabled(true, {
reason: 'Navigation active',
linuxOptions: {
applicationId: 'com.example.app',
reason: 'Navigation active'
}
})