displayz 1.1.0

A CLI tool and library to control display settings on Windows written in Rust.
use displayz::{Resolution, query_displays, refresh};

/// Prints and changes the current resolution of the primary display
fn main() -> Result<(), Box<dyn std::error::Error>> {
    let display_set = query_displays()?;
    println!("Discovered displays:\n{}", display_set);

    if let Some(settings) = display_set.primary().settings() {
        let res = (*settings).borrow().resolution;
        println!("Current resolution: {:?}", res);

        if res.height == 1080 {
            println!("Resolution is 1080p, changing to 720p");
            (*settings).borrow_mut().resolution = Resolution::new(1280, 720);
        } else {
            println!("Resolution is 720p, changing to 1080p");
            (*settings).borrow_mut().resolution = Resolution::new(1920, 1080);
        }
    } else {
        eprintln!("Primary display has no settings");
    }

    display_set.apply()?;
    refresh()?;

    Ok(())
}