Module shareable_content

Module shareable_content 

Source
Expand description

Shareable content types - displays, windows, and applications

This module provides access to the system’s displays, windows, and running applications that can be captured by ScreenCaptureKit.

§Main Types

§Workflow

  1. Call SCShareableContent::get() to retrieve available content
  2. Select displays/windows/apps to capture
  3. Create an SCContentFilter from the selection

§Examples

§List All Content

use screencapturekit::shareable_content::SCShareableContent;

// Get all shareable content
let content = SCShareableContent::get()?;

// List displays
for display in content.displays() {
    println!("Display {}: {}x{}",
        display.display_id(),
        display.width(),
        display.height()
    );
}

// List windows
for window in content.windows() {
    if let Some(title) = window.title() {
        println!("Window: {}", title);
    }
}

// List applications
for app in content.applications() {
    println!("App: {} ({})", app.application_name(), app.bundle_identifier());
}

§Filter On-Screen Windows Only

use screencapturekit::shareable_content::SCShareableContent;

let content = SCShareableContent::create()
    .with_on_screen_windows_only(true)
    .with_exclude_desktop_windows(true)
    .get()?;

println!("Found {} on-screen windows", content.windows().len());

Re-exports§

pub use display::SCDisplay;
pub use running_application::SCRunningApplication;
pub use window::SCWindow;

Modules§

display
running_application
window

Structs§

SCShareableContent
SCShareableContentInfo
Information about shareable content from a filter (macOS 14.0+)
SCShareableContentOptions