Switch icon indicating copy to clipboard operation
Switch copied to clipboard

Explore adopting ScreenCaptureKit

Open numist opened this issue 2 years ago • 2 comments

ScreenCaptureKit is the new blessèd way to capture screen contents (instead of CGWindowListCreateImage) and includes some useful features like automatically handling image resizing on the gpu.

Unfortunately the only way to manifest an SCWindow is from an instance of SCShareableContent, which affects all of Switch's window list and content code. Also the API is async which is cool but means even more rearchitecting.

let content = try await SCShareableContent.excludingDesktopWindows(false, onscreenWindowsOnly: true)

numist avatar May 02 '23 00:05 numist

Now that I've had some time to noodle on this, I think that WindowInfo needs to become a protocol, as should the interface that provides window content images. To aid in transition (and testing) it might be worth also protocolizing the window list publisher types (and making them actors). This way WindowInfoGroup can conform to WindowInfo/WindowContents and the existing struct WindowInfo can stick around as a value type used by both the unit tests and the CG window list publisher.

numist avatar Jun 09 '23 16:06 numist

lol I guess this just got more important. sigh.

Screenshot 2023-07-18 at 2 24 59 PM

numist avatar Jul 18 '23 21:07 numist