pub struct LinuxGeneralWindowCapture { /* private fields */ }Available on Linux only.
Expand description
General Linux window capture source that automatically selects the best capture method.
This wrapper automatically chooses between:
- PipeWire capture (for Wayland - captures via desktop portal with window selection)
- XComposite window capture (for traditional X11 setups - direct window capture)
The selection is based on the detected display server type.
§Example
use libobs_simple::sources::linux::LinuxGeneralWindowCapture;
use libobs_wrapper::{context::ObsContext, sources::ObsSourceBuilder, utils::StartupInfo};
// Automatically selects PipeWire or XComposite based on display server
let capture = LinuxGeneralWindowCapture::auto_detect(
context.runtime().clone(),
"Window Capture"
)?;
// Add to scene
scene.add(&capture)?;Implementations§
Source§impl LinuxGeneralWindowCapture
impl LinuxGeneralWindowCapture
Sourcepub fn auto_detect(
runtime: ObsRuntime,
name: &str,
) -> Result<Self, Box<dyn Error>>
pub fn auto_detect( runtime: ObsRuntime, name: &str, ) -> Result<Self, Box<dyn Error>>
Create a window capture source by auto-detecting the display server type.
This is the recommended way to create a window capture on Linux.
Sourcepub fn new(
runtime: ObsRuntime,
name: &str,
display_type: DisplayServerType,
) -> Result<Self, Box<dyn Error>>
pub fn new( runtime: ObsRuntime, name: &str, display_type: DisplayServerType, ) -> Result<Self, Box<dyn Error>>
Create a window capture source for a specific display server type.
§Arguments
runtime- The OBS runtimename- Name for the sourcedisplay_type- The display server type to create a source for
Sourcepub fn new_pipewire(
runtime: ObsRuntime,
name: &str,
) -> Result<Self, Box<dyn Error>>
pub fn new_pipewire( runtime: ObsRuntime, name: &str, ) -> Result<Self, Box<dyn Error>>
Create a PipeWire-based window capture source.
Note: On Wayland, window selection is handled by the desktop portal which will prompt the user to select a window.
Sourcepub fn new_xcomposite(
runtime: ObsRuntime,
name: &str,
) -> Result<Self, Box<dyn Error>>
pub fn new_xcomposite( runtime: ObsRuntime, name: &str, ) -> Result<Self, Box<dyn Error>>
Create an XComposite-based window capture source.
§Arguments
runtime- The OBS runtimename- Name for the source
Sourcepub fn new_xcomposite_with_window(
runtime: ObsRuntime,
name: &str,
window_id: &str,
) -> Result<Self, Box<dyn Error>>
pub fn new_xcomposite_with_window( runtime: ObsRuntime, name: &str, window_id: &str, ) -> Result<Self, Box<dyn Error>>
Create an XComposite-based window capture for a specific window.
§Arguments
runtime- The OBS runtimename- Name for the sourcewindow_id- The X11 window ID to capture
pub fn add_to_scene( self, scene: &mut ObsSceneRef, ) -> Result<ObsSourceRef, ObsError>
Sourcepub fn capture_type_name(&self) -> &str
pub fn capture_type_name(&self) -> &str
Get the type of capture being used.
Trait Implementations§
Source§impl AsRef<ObjectInfo> for LinuxGeneralWindowCapture
impl AsRef<ObjectInfo> for LinuxGeneralWindowCapture
Auto Trait Implementations§
impl Freeze for LinuxGeneralWindowCapture
impl RefUnwindSafe for LinuxGeneralWindowCapture
impl Send for LinuxGeneralWindowCapture
impl Sync for LinuxGeneralWindowCapture
impl Unpin for LinuxGeneralWindowCapture
impl UnwindSafe for LinuxGeneralWindowCapture
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more