Control display brightness from a Tauri application.
DDC/CI for external monitors, ddcutil for NVIDIA and docks, kernel backlight
for internal laptop panels.
This plugin is not officially approved by the Tauri Programme. It follows the Tauri plugin conventions, so it can be adopted upstream, but only codebases inside the
tauri-appsGitHub organisation are official. TAURI is a trademark of The Tauri Programme within the Commons Conservancy.
- Why two crates
- Install
- Backends
- Platform support
- Linux permissions
- Documentation
- Development
- Contributing
- License
Brightness control is useful outside a webview, so the engine is published on its own and the plugin is a thin layer over it:
| Crate | What it is |
|---|---|
tauri-brightness-core |
The engine. No Tauri, no GUI toolkit. Use it from any Rust program. |
tauri-plugin-brightness |
The Tauri 2 plugin: commands, permissions, Rust API. |
tauri-plugin-brightness-api |
Typed JavaScript bindings. |
examples/tauri-app |
Tray application that uses every feature, including the diagnostic panel. |
cargo add tauri-plugin-brightness
npm add tauri-plugin-brightness-apiRegister the plugin and allow its commands:
// src-tauri/src/lib.rs
tauri::Builder::default()
.plugin(tauri_plugin_brightness::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");// src-tauri/capabilities/default.json
{ "permissions": ["brightness:default"] }Then use it from the frontend:
import {
diagnose,
listMonitors,
setBrightness
} from 'tauri-plugin-brightness-api'
const monitors = await listMonitors()
for (const monitor of monitors) {
console.log(`${monitor.name}: ${monitor.brightness}/${monitor.max}`)
}
if (monitors.length === 0) {
// Explains which permission is missing instead of failing silently.
const report = await diagnose()
console.warn(report.suggestions.join('\n'))
} else {
await setBrightness(monitors[0].id, 50)
}The full reference, including the Rust API, the permission list and the troubleshooting guide, is in the plugin README.
Three backends are tried in order, and the display identifiers say which one handled each monitor:
- DDC/CI over I2C through the pure Rust
ddc-hicrate. Fast, in process, and the default choice. ddcutil, the standard Linux DDC/CI tool. Slower, but it is the only backend that works with the NVIDIA proprietary driver, USB-C docks and DisplayLink adapters.- Kernel backlight at
/sys/class/backlight. Internal laptop panels are not DDC/CI devices, so they are always enumerated in addition to the others.
| Platform | Supported | Notes |
|---|---|---|
| Linux | ✓ | DDC/CI, ddcutil and kernel backlight |
| Windows | Partial | DDC/CI through the Windows API backend of ddc-hi |
| macOS | Partial | DDC/CI through the macOS backend of ddc-hi |
| Android | ✗ | Not a desktop concept |
| iOS | ✗ | Not a desktop concept |
External monitors need I2C access; internal panels do not.
sudo modprobe i2c-dev
sudo usermod -aG i2c "$USER" # then log out and back in
sudo apt install ddcutil # optional but recommendedIf no display is detected, the diagnose command reports which of these is
missing and prints the command to fix it. The example application shows this in
a panel instead of a slider that does nothing.
| Document | Read it when |
|---|---|
| Plugin reference | Using the plugin: every command, the permission list, and troubleshooting |
| Engine reference | Using the brightness control outside Tauri |
| Example application | Seeing a full tray app built with the plugin |
| docs/ | The project's place in the Tauri ecosystem |
| SECURITY.md | Reporting a vulnerability, and the fixed ones |
| CHANGELOG.md | What changed in each release |
Contributions are welcome. The example application doubles as the integration test, and hardware behaviour cannot be covered by unit tests, so please say which monitor and desktop environment you tested against.
cargo test --workspace
cargo clippy --workspace --all-targets -- -D warningsSee CONTRIBUTING.md for the repository layout and the testing expectations, and CODE_OF_CONDUCT.md for the community guidelines.
The workspace needs Rust 1.90 or newer, driven by tauri 2.12.
cargo test --workspace
cargo clippy --workspace --all-targets
cd crates/tauri-plugin-brightness/examples/tauri-app
npm install && npm run devSee CONTRIBUTING.md for the layout and the testing expectations, and docs/ for the project's place in the Tauri ecosystem.
Licensed under either of Apache License, Version 2.0 or MIT license, at your option.