pub struct SCShareableContent(/* private fields */);Implementations§
Sourcepub fn get() -> Result<Self, SCError>
pub fn get() -> Result<Self, SCError>
Get shareable content (displays, windows, and applications)
§Examples
use screencapturekit::shareable_content::SCShareableContent;
let content = SCShareableContent::get()?;
println!("Found {} displays", content.displays().len());
println!("Found {} windows", content.windows().len());
println!("Found {} apps", content.applications().len());§Errors
Returns an error if screen recording permission is not granted.
Sourcepub fn create() -> SCShareableContentOptions
pub fn create() -> SCShareableContentOptions
Create options builder for customizing shareable content retrieval
§Examples
use screencapturekit::shareable_content::SCShareableContent;
let content = SCShareableContent::create()
.with_on_screen_windows_only(true)
.with_exclude_desktop_windows(true)
.get()?;Sourcepub fn displays(&self) -> Vec<SCDisplay>
pub fn displays(&self) -> Vec<SCDisplay>
Get all available displays
§Examples
use screencapturekit::shareable_content::SCShareableContent;
let content = SCShareableContent::get()?;
for display in content.displays() {
println!("Display: {}x{}", display.width(), display.height());
}Sourcepub fn windows(&self) -> Vec<SCWindow>
pub fn windows(&self) -> Vec<SCWindow>
Get all available windows
§Examples
use screencapturekit::shareable_content::SCShareableContent;
let content = SCShareableContent::get()?;
for window in content.windows() {
if let Some(title) = window.title() {
println!("Window: {}", title);
}
}Sourcepub fn applications(&self) -> Vec<SCRunningApplication>
pub fn applications(&self) -> Vec<SCRunningApplication>
Get all available running applications
§Examples
use screencapturekit::shareable_content::SCShareableContent;
let content = SCShareableContent::get()?;
for app in content.applications() {
println!("App: {} (PID: {})", app.application_name(), app.process_id());
}Sourcepub fn snapshot(&self) -> Option<ContentSnapshot>
pub fn snapshot(&self) -> Option<ContentSnapshot>
Fetch every display, window, and running application in a single batched
FFI round-trip — see ContentSnapshot for what’s returned.
Use this in any code path that reads more than one attribute per
window / display / app. The per-element accessors (displays,
windows, applications + per-attribute methods like
SCWindow::title / SCWindow::frame) issue one FFI call each
— a typical “list windows with title and frame” walk on a 220-window
system measured at ~73 µs. snapshot() collapses that to ~5 µs (~15×
faster) by going through the bridge’s packed FFI surface and copying
every attribute into Rust-side plain data structs in a single pass.
Returns None if the bridge couldn’t fit the data into the static
scratch buffers (extremely unlikely — limits are 64 displays, 4096
windows, 1024 apps with a 256 KiB string pool).
Sourcepub fn current_process() -> Result<Self, SCError>
pub fn current_process() -> Result<Self, SCError>
Get shareable content for the current process only (macOS 14.4+)
This retrieves content that the current process can capture without requiring user authorization via TCC (Transparency, Consent, and Control).
§Errors
Returns an error if retrieval fails.