diff --git a/libwayshot/src/lib.rs b/libwayshot/src/lib.rs index 1ed7f054..571720c0 100644 --- a/libwayshot/src/lib.rs +++ b/libwayshot/src/lib.rs @@ -526,17 +526,14 @@ impl WayshotConnection { | wl_shm::Format::Bgr888 ) }) - .copied(); + .copied() + // Check if frame format exists. + .ok_or_else(|| { + tracing::error!("No suitable frame format found"); + Error::NoSupportedBufferFormat + })?; tracing::trace!("Selected frame buffer format: {:#?}", frame_format); - // Check if frame format exists. - let frame_format = match frame_format { - Some(format) => format, - None => { - tracing::error!("No suitable frame format found"); - return Err(Error::NoSupportedBufferFormat); - } - }; Ok((state, event_queue, frame, frame_format)) } @@ -816,7 +813,7 @@ impl WayshotConnection { Ok(x) => x, Err(e) => { tracing::error!( - "Failed to create compositor Does your compositor implement WlCompositor?" + "Failed to create compositor. Does your compositor implement WlCompositor?" ); tracing::error!("err: {e}"); return Err(Error::ProtocolNotFound( @@ -1065,7 +1062,8 @@ impl WayshotConnection { ) -> Result { self.screenshot_region_capturer(RegionCapturer::Freeze(callback), cursor_overlay) } - /// shot one ouput + + /// Take a screenshot from one output pub fn screenshot_single_output( &self, output_info: &OutputInfo,