---
title: "getExcludingDesktopWindows(_:onScreenWindowsOnly:completionHandler:)"
framework: screencapturekit
role: symbol
role_heading: Type Method
path: "screencapturekit/scshareablecontent/getexcludingdesktopwindows(_:onscreenwindowsonly:completionhandler:)"
---

# getExcludingDesktopWindows(_:onScreenWindowsOnly:completionHandler:)

Retrieves the displays, apps, and windows that match your criteria.

## Declaration

```swift
class func getExcludingDesktopWindows(_ excludeDesktopWindows: Bool, onScreenWindowsOnly: Bool, completionHandler: @escaping @Sendable (SCShareableContent?, (any Error)?) -> Void)
```

```swift
class func excludingDesktopWindows(_ excludeDesktopWindows: Bool, onScreenWindowsOnly: Bool) async throws -> SCShareableContent
```

## Parameters

- `excludeDesktopWindows`: A Boolean value that indicates whether to exclude desktop windows like Finder, Dock, and Desktop from the set of shareable content.
- `onScreenWindowsOnly`: A Boolean value that indicates whether to include only onscreen windows in the set of shareable content.
- `completionHandler`: A callback the system invokes with the shareable content, or an error if a failure occurs.

## Discussion

Discussion Use this method to retrieve the onscreen content matching your filtering criteria. If the call is successful, the system passes an SCShareableContent instance to the completion handler; otherwise, it returns an error that describes the failure.

## See Also

### Retrieving shareable content

- [getWithCompletionHandler(_:)](screencapturekit/scshareablecontent/getwithcompletionhandler(_:).md)
- [getExcludingDesktopWindows(_:onScreenWindowsOnlyAbove:completionHandler:)](screencapturekit/scshareablecontent/getexcludingdesktopwindows(_:onscreenwindowsonlyabove:completionhandler:).md)
- [getExcludingDesktopWindows(_:onScreenWindowsOnlyBelow:completionHandler:)](screencapturekit/scshareablecontent/getexcludingdesktopwindows(_:onscreenwindowsonlybelow:completionhandler:).md)
- [info(for:)](screencapturekit/scshareablecontent/info(for:).md)
