How to detect screen sharing on macOS?

Hello! I'd like to ask, is there any method how could I detect whether an application started to share or record my screen? It seems there isn't any notification from the system but maybe it's possible to detect somehow. Programmatically or from the CLI.

Replies

Gergely Santa, did you find a solution to your problem? I ran into a similar situation where I needed my app to be able to detect screen sharing. I would be very grateful for information on this.