#ddc-ci #ddc #cross-platform #linux

ddc-enhanced-rs

DDC/CI high level library for Rust (cross platform)

29 releases (stable)

1.2.7 Jun 19, 2022
1.2.0 Jun 18, 2022
1.1.2 Apr 18, 2022
0.1.5 Apr 16, 2022
0.1.1 Mar 30, 2022

#695 in Unix APIs

Download history 12/week @ 2024-03-09 2/week @ 2024-03-16 8/week @ 2024-03-30 2/week @ 2024-04-06

63 downloads per month

MIT license

18KB
419 lines

ddc-enhanced-rs

ddc-enhanced-rs is a cross platform Rust crate and Node package for controlling monitors with DDC/CI.

Documentation

Rust: https://docs.rs/ddc-enhanced-rs

NodeJS: https://github.com/ThalusA/ddc-enhanced-rs/blob/master/index.d.ts

Examples

Rust

use ddc_enhanced_rs::{get_enhanced_displays, get_brightness,
                      set_brightness, does_display_support_ddc};

// index in array is the id of the display
fn main() -> Result<(), std::io::Error> {
    for id in 0..get_enhanced_displays(false)?.len() {
        let value = get_brightness(id)?.value();
        set_brightness(id, value + 2).unwrap();
    }
    Ok(())
}

NodeJS

import Display from "ddc-enhanced-rs";

for (const display_info of Display.info()) {
    const display = new Display(display_info.id);
    const { value } = display.get_brightness();
    display.set_brightness(value + 2);
}

Dependencies

~2.5–4MB
~75K SLoC