Expand description
Control display brightness through DDC/CI and the Linux kernel backlight.
The plugin is a thin layer over the
tauri-brightness-core
crate: it exposes the same operations as commands, adds the permission
definitions Tauri requires, and ships JavaScript bindings.
§Setup
tauri::Builder::default().plugin(tauri_plugin_brightness::init());The plugin can also be used directly from Rust, through the
BrightnessExt extension trait:
use tauri::Manager;
use tauri_plugin_brightness::BrightnessExt;
let monitors = app.brightness().list_monitors();
println!("{} display(s) detected", monitors.len());§Permissions
The commands are not reachable from the webview until they are allowed by a
capability. default.toml allows all of them, so the common case only needs
the plugin to be registered:
{
"permissions": ["brightness:default"]
}Grant brightness:allow-set-brightness alone when an application should be
able to change brightness but not read it.
§Linux permissions
DDC/CI needs the i2c-dev kernel module and usually membership of the i2c
group. Internal panels need neither. When no display is detected, the
diagnose command reports exactly which piece is missing.
Re-exports§
pub use models::BrightnessPayload;
Modules§
- models
- Data types shared with the JavaScript bindings. Data types shared between the commands, the desktop implementation and the JavaScript bindings.
Structs§
- Diagnostics
- Result of probing the system for brightness capabilities.
- Monitor
Info - A display whose brightness can be read and written.
Enums§
Traits§
- Brightness
Ext - Extends a Tauri manager with access to the brightness API.
Functions§
- init
- Initializes the plugin.