Skip to main content

take_a_shot

Function take_a_shot 

Source
pub(crate) fn take_a_shot(
    connection: &Connection,
    queue: &mut EventQueue<Probe>,
    probe: &mut Probe,
    region: Option<(i32, i32, i32, i32)>,
) -> Result<(), String>
Expand description

Ask for a screenshot, and look at it.

The only check here that examines what the compositor drew rather than what it said. Every other one reads an event; this one reads pixels, which is the difference between “the protocol answers” and “there is a desktop in the buffer”.

Nothing that speaks this protocol is installed on the machine this was written on — no grim, no wf-recorder, no portal — so this is not a convenience. It is the only oracle there is.

WL_PROBE_SHOT=<path> writes the capture out as a binary PPM, because “some pixels were not zero” and “that is my desktop” are different claims and only one of them can be checked by a program.