I've created an Automator Quick Action called "Screenshot" that uses the "Run Shell Script" action to run a script in my path, which uses Mac OS's built in
screencapture command and then uploads the file to a Google Cloud Storage bucket. I've done this so I can use my Screenshot script from the Touch Bar by holding Fn to see the Quick Actions menu.
Here's the problem: when I take a screenshot while focused on an app that doesn't have Screen Recording permissions in Security and Privacy, I only get a picture of my wallpaper. Everything works fine in apps that have Screen Recording permissions, or when running it from Automator manually.
I suspect that Automator inherits its permissions from the window in which it is running. Therefore, I would like to know how to manually grant Screen Recording permissions to my most commonly used apps, so that I can take screenshots within them.
There are no add/remove buttons in the Security and Privacy section, and I cannot modify the database manually because of SIP.
Or, if there's a way to do so, I'd like to have the shell script run within the context of iTerm 2 (which does have Screen Recording permissions) instead of the context of the currently focused app.
I have had some similar issues. My workaround was to add the Automator created app to:
System Preferences → Security & Privacy → Accessibility
Then running the app, letting the system add the programs it may control to:
System Preferences → Security & Privacy → Automation
This might not at all be what you asked for, but I thought it seemed a bit similar.
Note however, every time I change something in the app, I have to repeat the above steps.