9 releases (breaking)

Uses new Rust 2024

0.8.0 Sep 2, 2025
0.7.0 Jul 23, 2025
0.6.0 Jul 16, 2025
0.5.0 Sep 10, 2022
0.1.0 Jul 28, 2021

#217 in Hardware support

Download history 91/week @ 2025-10-02 32/week @ 2025-10-09 79/week @ 2025-10-16 76/week @ 2025-10-23 38/week @ 2025-10-30 41/week @ 2025-11-06 34/week @ 2025-11-13 41/week @ 2025-11-20 38/week @ 2025-11-27 34/week @ 2025-12-04 27/week @ 2025-12-11 39/week @ 2025-12-18 30/week @ 2025-12-25 127/week @ 2026-01-01 18/week @ 2026-01-08 105/week @ 2026-01-15

286 downloads per month
Used in 6 crates

0BSD license

49KB
969 lines

Overview

This crate provides definitions to get and set display brightness.

Linux and Windows are supported.

Example

use brightness::Brightness;
use futures::TryStreamExt;

async fn show_brightness() -> Result<(), brightness::Error> {
    brightness::brightness_devices().try_for_each(|dev| async move {
        let name = dev.device_name().await?;
        let value = dev.get().await?;
        println!("Brightness of device {} is {}%", name, value);
        Ok(())
    }).await
}

Linux

This crate interacts with devices found at /sys/class/backlight. This means that the ddcci-backlight kernel driver is required to control external displays (via DDC/CI).

Setting brightness is attempted using D-Bus and logind, which requires systemd 243 or newer. If this fails because the method is not available, the desired brightness is written to /sys/class/backlight/$DEVICE/brightness, which requires permission (udev rules can help with that).

Contribute

All contributions shall be licensed under the 0BSD license.

Dependencies

~0.6–36MB
~608K SLoC