Trigger based on Screen Sharing (or recording)

Hello!

A super helpful feature for me would be the ability to trigger an action when screen sharing (or screen recording) starts and stops.

I would like to be able to switch my focus mode (by running an Apple Shortcut) when screen sharing starts and stops. Is this currently possible?

Thanks in advance for considering!

Don't think this is possible, or if then you would have to look at it for every app . Probably easiest to make a keyboard shortcut to run before and after.