XCap is a cross-platform screen capture library written in Rust. It supports Linux (X11, Wayland), MacOS, and Windows. XCap supports screenshot and video recording (to be implemented).
I run this code and being panic in Ubuntu 20.04 Wayland: called Result::unwrap() on an Err value: IoError(Custom { kind: Other, error: "Zero width not allowed" }). Here is my code:
`
use screenshots::Screen;
fn main() {
let screens = Screen::all().unwrap();
for screen in screens {
println!("Capturing {screen:?}");
let image = screen.capture_area(screen.display_info.x, screen.display_info.y, screen.display_info.width, screen.display_info.height).unwrap();
image.save(format!("images/{}.png", screen.display_info.id)).unwrap();
}
I run this code and being panic in Ubuntu 20.04 Wayland:
called Result::unwrap() on an Err value: IoError(Custom { kind: Other, error: "Zero width not allowed" })
. Here is my code: ` use screenshots::Screen; fn main() { let screens = Screen::all().unwrap();}`