nashaofu / xcap

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).

Home Page:https://docs.rs/xcap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Panic at capture area on ubuntu gnome

arne-fuchs opened this issue · comments

Tested on Debian 12 with XFCE and worked. Now compiled same program on Ubuntu 22.04.3 LTS with GNOME and crashes with following error:

thread '<unnamed>' panicked at 'called Result::unwrap()on anErr` value: xcb protocol error

Caused by:
X(Match(RequestError { response_type: 0, error_code: 8, sequence: 1, bad_value: 951, minor_opcode: 0, major_opcode: 73, pad: 1 }), Some("x::GetImage"))', src/main.rs:58:38
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
`
at command

screen.capture_area(x,y,w,h).unwrap()

Are you connecting to the host through SSH? Please set the following environment variables, otherwise the operating environment cannot be detected correctly.

export DISPLAY=:0
export XDG_SESSION_TYPE=wayland
export WAYLAND_DISPLAY=wayland-0