Expand description

XRandR-Parser

XRandR-Parser is a interface for parsing the output of xrandr --query into Rust Stuctures and filter through methods.

Example

Get the available resolutions for HDMI-1 and the available refresh rates for HDMI-1 @ 1920 x 1080.

#[allow(non_snake_case)]

use xrandr_parser::Parser;

fn main() -> Result<(), String> {
    let mut XrandrParser = Parser::new();

    XrandrParser.parse()?;

    let connector = &XrandrParser.get_connector("HDMI-1")?;

    let available_resolutions = &connector.available_resolutions_pretty()?;
    let available_refresh_rates = &connector.available_refresh_rates("1920x1080")?;

    println!(
        "Available Resolutions for HDMI-1: {:#?}",
        available_resolutions
    );
    println!(
        "Available Refresh Rates for HDMI-1 @ 1920x1080: {:#?}",
        available_refresh_rates
    );
    Ok(())
}

Modules

Structs