Exclude application from capture

Hey folks,

I’m building an application that should never be visible in screen shares or recordings - even when sharing the entire screen.

I’ve considered patching xdg-desktop-portal-kde to filter out my app from screen sharing - or maybe I should patch KWin instead? Are there any alternatives or standard-compliant ways (e.g. with Wayland or directly PipeWire) to mark a window as “exclude from capture”? On Windows, we have a flag exclude_from_capture, which works great - to some extend. The app is not rendered at all as if it was transparent, but not all apps respect it, so I wondered if it’s achievable via linux portal implementation,

The goal is to prevent accidental leaking of sensitive data, so I want a robust solution that works at the compositor or portal level. Any insight or experience would be greatly appreciated.

Hi! I’m not a developer or expert, but wanted to at least pass along a couple of things I had read on the topic that might be interesting in the meantime :slight_smile:

And maybe some clarification - is the goal only to prevent accidental screenshotting of sensitive data while doing something innocuous (like capturing images for a user walkthrough guide) by users who will already be on a highly-controlled system, or is it also to guard against malicious activity? Is the application something that naturally takes up a large portion of the display, or is it more sidebar or banner-sized?

I’m developing an application for streamers that is basically an overlay with data that shouldn’t be visible for the users. So when the streamer shares his screen using Zoom, Discord, OBS or whatever, the overlay should be visible to him, but should be excluded from the screen casting. WindowsDisplayAffinity has a similar option with a “EXCLUDE_FROM_CAPTURE” flag - the window marked with it, will simply not appear on the screen share, but will stay visible on the physical monitor.

And yeah, I went through all the stackoverflow - the closest I saw is the Niri compositor for Wayland Linux, which forces their composer to black out certain windows. I think it’s a very much needed feature for other WM such as KWin. Even for privacy purposes.

1 Like