3 releases (breaking)
0.3.0 | Jul 11, 2022 |
---|---|
0.2.0 | Jul 11, 2022 |
0.1.0 | Jul 8, 2022 |
#4 in #xrandr
44 downloads per month
38KB
340 lines
XRandR-Parser
XRandR-Parser is a interface for parsing the output of xrandr --query
into
Rust Stuctures and filter through methods.
Testing
$ EXAMPLE_DIR=$(pwd)/examples cargo test --doc --features "test"
License
All files in this project are distributed under the GNU GPLv3 or later license.
lib.rs
:
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(())
}
Dependencies
~0.7–1.3MB
~29K SLoC